
Excel functions for accountants serve four tasks that recur at every close: lookups and matching, summing and counting by criteria, dates and rounding, and financial calculations such as loan payments, net present value and rates of return. Below, each function is explained as Microsoft's support pages describe it, then applied in three worked examples: a receivables aging, matching receipts to the bank statement, and a straight-line depreciation schedule.
Quick map: which function for which task?
| Task | Function | What it does, per Microsoft |
|---|---|---|
| Pull data from a table | VLOOKUP / XLOOKUP | Find things in a table or range by row |
| Sum by criteria | SUMIFS | Add the values that meet multiple criteria |
| Count by criteria | COUNTIFS | Count the number of times all criteria are met |
| Decision logic | IF | One value if a condition is true, another if it is false |
| Error handling | IFERROR | A value you specify if a formula evaluates to an error |
| Month-end dates | EOMONTH | Last day of the month a set number of months before or after a date |
| Rounding | ROUND | Round a number to a specified number of digits |
| Sum of products | SUMPRODUCT | Sum of the products of corresponding ranges or arrays |
| Cleaning text | TRIM / CLEAN | Remove extra spaces / nonprintable characters |
| Depreciation | SLN | Straight-line depreciation of an asset for one period |
| Loans | PMT | Payment for a loan with constant payments and a constant interest rate |
| Appraisal | NPV and XNPV, IRR and XIRR | NPV and IRR for periodic, or not necessarily periodic, cash flows |
Lookups: VLOOKUP and XLOOKUP
VLOOKUP
The syntax is VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]). Microsoft requires the lookup value to be in the first column of the range; the result comes from the column number you specify (1 for the left-most column). VLOOKUP therefore looks from left to right only.
Watch the fourth argument: if you leave it out, the match is approximate (TRUE) by default, which assumes the first column is sorted; otherwise the result may not be what you expect. For account numbers and codes, always write FALSE:
=VLOOKUP(A2, $F$2:$H$500, 2, FALSE)
#N/A means different things depending on that argument: with FALSE, the exact value was not found; with TRUE, the lookup value is smaller than the smallest value in the first column.
XLOOKUP
The syntax is XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]). It searches one column and returns the result from the same row in another column, regardless of which side the return column is on, and exact match is the default. Where no valid match is found it returns the [if_not_found] text you supply; if that argument is missing, it returns #N/A:
=XLOOKUP(A2, COA[AccountNo], COA[AccountName], "Not in chart of accounts")
For band tables (commission or discount rates by amount), use match_mode -1: exact match, and if none is found, return the next smaller item.
Availability: Microsoft notes that XLOOKUP is not available in Excel 2016 and Excel 2019, although they may open a workbook containing it that someone else created in a newer version. If the file will be opened in either version, use VLOOKUP instead.
Before any match: data types and spaces
From the best practices on Microsoft's VLOOKUP page:
- Don't store numbers or dates as text in the first column: VLOOKUP might return an incorrect or unexpected value.
- Clean the first column of leading or trailing spaces, inconsistent quotation marks and nonprinting characters, using TRIM or CLEAN.
Both have limits that matter for bank and system exports:
- TRIM removes all spaces from text except single spaces between words, but by itself does not remove the nonbreaking space (value 160) common in web pages.
- CLEAN removes nonprintable characters; it was designed for the first 32 nonprinting characters in 7-bit ASCII (values 0 to 31) and by itself does not remove the additional nonprinting Unicode characters (values 127, 129, 141, 143, 144 and 157).
=TRIM(CLEAN(B2))
Summing and counting by criteria: SUMIFS and COUNTIFS
SUMIFS(sum_range, criteria_range1, criteria1, ...) adds the values that meet multiple criteria, with up to 127 range/criteria pairs. The criteria range must contain the same number of rows and columns as the sum range, and text criteria go in quotation marks; otherwise you may see 0 instead of the expected result. Example: one account's expense for March 2026:
=SUMIFS(GL[Amount], GL[Account], "5101", GL[Date], ">="&DATE(2026,3,1), GL[Date], "<="&EOMONTH(DATE(2026,3,1),0))
COUNTIFS counts the number of times all criteria are met; each additional range must have the same number of rows and columns as the first. One use is flagging duplicate invoices before payment, with IF (one value if a condition is true, another if it is false):
=IF(COUNTIFS(AP[Supplier],[@Supplier], AP[InvoiceNo],[@InvoiceNo], AP[Amount],[@Amount])>1, "Duplicate", "")
Error handling: IFERROR or if_not_found?
IFERROR(value, value_if_error) returns a value you specify if a formula evaluates to an error, otherwise the formula's result. Microsoft's page lists the seven error types it evaluates: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? and #NULL!.
So wrapping a lookup in IFERROR can hide a broken reference (#REF!) behind a "not found" message, whereas XLOOKUP's [if_not_found] applies only where a valid match is not found.
Dates and rounding: EOMONTH and ROUND
Excel stores dates as sequential serial numbers so they can be used in calculations; subtracting one date from another gives the days between them. EOMONTH(start_date, months) returns the last day of the month the given number of months before or after the start date; Microsoft suggests it for maturity or due dates that fall on the last day of the month. Enter dates with the DATE function (or as the results of other formulas or functions), because dates entered as text can cause problems.
ROUND(number, num_digits) rounds to the specified number of digits: a positive value for decimal places, 0 for the nearest integer, a negative value to the left of the decimal point. In payment and depreciation schedules, one way is to round each amount to two decimals and put the rounding difference in the final period (third example).
SUMPRODUCT: the sum of products
SUMPRODUCT returns the sum of the products of corresponding ranges or arrays — for example, inventory value as quantity × unit cost, summed over all items:
=SUMPRODUCT(Inv[Qty], Inv[UnitCost])
The arrays must have the same dimensions, or it returns #VALUE!; non-numeric entries count as zeros, and Microsoft advises against full column references (such as A:A) for performance.
Financial functions: PMT, NPV, IRR and their relatives
PMT: the loan payment
PMT(rate, nper, pv, [fv], [type]) calculates the payment for a loan based on constant payments and a constant interest rate. The payment includes principal and interest but no taxes, reserve payments or fees. Keep units consistent: for monthly payments, divide the annual rate by 12 and multiply the years by 12.
Illustrative: a 200,000 loan at 6% a year, repaid at the end of each month over 5 years:
=PMT(6%/12, 5*12, 200000)
The result is -3,866.56 a month, shown as a negative amount, as is the result of Microsoft's own example. Payment × number of payments gives the total paid: about 231,994, of which about 31,994 is interest.
NPV and XNPV: net present value
NPV(rate, value1, ...) calculates the net present value of an investment using a discount rate and a series of future payments (negative values) and income (positive values). The values must be equally spaced in time and occur at the end of each period: the investment begins one period before the date of the first value. If the first cash flow occurs at the beginning of the first period, add it to the NPV result rather than including it in the values.
Illustrative: a project costing 50,000 today returns 18,000, 20,000 and 25,000 at the end of each of the next three years; discount rate 10%:
| Formula | Result |
|---|---|
=NPV(10%, 18000, 20000, 25000) - 50000 (correct) | 1,675.43 |
=NPV(10%, -50000, 18000, 20000, 25000) (wrong: moves every flow, today's cost included, one year later) | 1,523.12 |
XNPV(rate, values, dates) handles a schedule of cash flows that is not necessarily periodic: the first date starts the schedule, all other dates must be later, and succeeding payments are discounted on a 365-day year.
IRR and XIRR: internal rate of return
IRR(values, [guess]) returns the internal rate of return for cash flows that need not be even, but must occur at regular intervals, such as monthly or annually, and must include at least one positive and one negative value. It is the rate at which net present value is zero. Here the initial cost goes into the values: if B2:B5 hold -50,000, 18,000, 20,000 and 25,000, =IRR(B2:B5) gives about 11.79%. If it returns #NUM!, try a different guess.
XIRR(values, dates, [guess]) does the same for a schedule that is not necessarily periodic — the rate at which XNPV is zero. For investment decisions, see feasibility studies with NPV and IRR.
Three worked accounting examples
1) Receivables aging with SUMIFS
Illustrative data; the report date, 31 March 2026, is in cell H1, and Days = report date − due date (=$H$1-[@DueDate]):
| Invoice | Customer | Due date | Amount | Days past due |
|---|---|---|---|---|
| F-101 | A | 15 January 2026 | 12,000 | 75 |
| F-102 | B | 28 February 2026 | 8,500 | 31 |
| F-103 | A | 10 March 2026 | 6,000 | 21 |
| F-104 | C | 20 April 2026 | 4,000 | -20 |
| F-105 | B | 5 December 2025 | 3,200 | 116 |
The 1–30 day band (change the limits for each band):
=SUMIFS(AR[Amount], AR[Days], ">=1", AR[Days], "<=30")
Results: not yet due (zero or less) 4,000 · 1–30 days 6,000 · 31–60 days 8,500 · 61–90 days 12,000 · over 90 days 3,200. The total, 33,700, is agreed to the receivables control account. Keep "not yet due" as its own band: a nested IF that starts with "Days ≤ 30" puts F-104 into the 0–30 overdue band.
2) Matching the month's receipts to the bank statement
| Reference | Books | Bank statement |
|---|---|---|
| R-01 | 15,000 | 15,000 |
| R-02 | 7,250 | 7,250 |
| R-03 | 4,800 | 4,080 |
| R-04 | 2,600 | — |
| TR-77 | — | 3,000 |
| Total | 29,650 | 29,330 |
From the books side, XLOOKUP fetches each reference's bank amount and IF labels the line:
=XLOOKUP([@Ref], Bank[Ref], Bank[Amount], "Not found")
=IF([@Bank]="Not found", "Not in bank", IF([@Bank]=[@Amount], "Matched", "Amount difference"))
A one-way lookup never finds TR-77, so check the other way from the bank side: =IF(COUNTIFS(Book[Ref],[@Ref])=0, "Not in books", "").
Assumptions: R-04 was deposited on 31 March and appears on the April statement; the deposit slip confirms R-03 was 4,080 (the error is in the books); TR-77 is a customer transfer not yet recorded. Adjusted books = 29,650 + 3,000 − 720 = 31,930; adjusted bank = 29,330 + 2,600 = 31,930. The full procedure is in bank reconciliation step by step.
3) A straight-line depreciation schedule: SLN, EOMONTH and ROUND
The depreciable amount shall be allocated on a systematic basis over the useful life (IAS 16.50), and depreciation begins when the asset is available for use (IAS 16.55). The straight-line method results in a constant charge over the useful life if the residual value does not change, and the entity selects the method that most closely reflects the expected pattern of consumption of the asset's future economic benefits (IAS 16.62).
Assumptions (illustrative): cost 120,000; residual value 12,000; useful life 5 years; available for use on 1 April 2026; calendar financial year; straight-line reflects the expected pattern of consumption; monthly depreciation; no change in estimates.
- Monthly charge:
=SLN(120000, 12000, 60)= 1,800 — SLN returns one period's depreciation; the life here is in months. - First month-end:
=EOMONTH(DATE(2026,4,1),0)= 30 April 2026, then=EOMONTH(A2,1)for each following month.
| Year | Months | Depreciation | Accumulated | Carrying amount |
|---|---|---|---|---|
| 2026 | 9 | 16,200 | 16,200 | 103,800 |
| 2027 | 12 | 21,600 | 37,800 | 82,200 |
| 2028 | 12 | 21,600 | 59,400 | 60,600 |
| 2029 | 12 | 21,600 | 81,000 | 39,000 |
| 2030 | 12 | 21,600 | 102,600 | 17,400 |
| 2031 | 3 | 5,400 | 108,000 | 12,000 |
The final carrying amount of 12,000 equals the residual value, a built-in check. When the amount does not divide evenly — say another asset costing 100,000 with no residual value over 84 months (1,190.476…) — =ROUND(SLN(100000,0,84),2) gives 1,190.48, and 84 such charges would total 100,000.32. The 0.32 is the accumulated rounding difference, so the last month is set to 1,190.16 (100,000 − 83 × 1,190.48) and the total equals the depreciable amount. Recording these amounts is covered in depreciation entries.
Common mistakes Microsoft warns about
| Mistake | What the function page says |
|---|---|
| Leaving range_lookup blank in VLOOKUP | The default is approximate match, which needs a sorted first column |
| Text criteria without quotation marks in SUMIFS | 0 may be shown instead of the expected result |
| Ranges of different sizes | SUMIFS and COUNTIFS need the same rows and columns; SUMPRODUCT returns #VALUE! |
| Putting today's cost inside NPV | NPV begins one period before the first value |
For wider analysis and dashboards, see financial data analysis (Excel and BI); for protecting the files from errors and manipulation, see Excel file governance.
A practical tool
If you would rather not build the schedule yourself, the Fixed Assets Register produces the asset movement schedule for the notes (cost, accumulated depreciation and net amount) for the current period and the prior year, monthly depreciation by category, disposals and the reconciliation with the general ledger, and runs on Excel 2013 or later without macros. It covers the straight-line method and the cost model only: no revaluation, no impairment, no partial disposal of an asset and no right-of-use assets.
Sources
- Microsoft Support, function pages: VLOOKUP function · XLOOKUP function · SUMIFS function · COUNTIFS function · IF function · IFERROR function · TRIM function · CLEAN function · EOMONTH function · ROUND function · SUMPRODUCT function · SLN function · PMT function · NPV function · XNPV function · IRR function · XIRR function (accessed 26 October 2026).
- IFRS Foundation: IAS 16 Property, Plant and Equipment — paragraphs 50, 55 and 62.
