dataSights

Building an aged receivables or aged payables report in Excel

Last updated

This guide shows you how to build an aged receivables report in Excel from your dataSights database, with ageing buckets that update automatically when you change the report date.

You only need to do steps 1 to 7 once. After that, running the report again is a two-click job.

What you will need

  • Microsoft Excel (2019 or later, or Microsoft 365)

  • The server name and database name, which the dataSights team will provide

Step 1: Connect and load the data

In Excel, go to Data then Get Data then From Database then From SQL Server Database.

Enter the server and database name we have provided, then find XeroConsolidationAgedReceivableDetailReportView in the list and click Load. The data will appear on a new sheet.

Step 2: Set the report date

Add a new sheet and rename it Settings.

In cell B1 of that sheet, type the date you want the report to run as at, for example 31/08/2026. Everything below uses this one date.

Step 3: Add the Bucket column

Go back to the data sheet. In the header row, click the first empty cell to the right of the last column and type Bucket, then press Enter.

In the cell directly below it, paste this and press Enter:

=IFS(Settings!$B$1<=[@DueDate],"Current",Settings!$B$1-[@DueDate]<=30,"< 1 Month",Settings!$B$1-[@DueDate]<=60,"1 Month",Settings!$B$1-[@DueDate]<=90,"2 Months",TRUE,"Older")

Excel should fill the whole column automatically. If it does not, copy that cell, select the rest of the column, and paste.

Step 4: Add the AsAt column

In the next empty header cell, type AsAt. In the cell below it, paste:

=IF([@Date]<=Settings!$B$1,"Include","Exclude")

This leaves out anything dated after your report date.

Step 5: Build the pivot table

Click any cell in the data, then Insert then PivotTable then OK.

Drag the fields into these boxes on the right of the screen:

Box

Field

Filters

XeroOrganisationName, AsAt

Rows

ContactName

Columns

Bucket

Values

NetAmount

Step 6: Set the filters

At the top of the pivot table, click the AsAt dropdown and choose Include.

Then click the XeroOrganisationName dropdown and choose the entity you want to report on.

Step 7: Put the columns in the right order

The columns will come out alphabetically, which is the wrong order for an aged report. You only need to do this once.

  1. Click File then Options.

  2. Click Advanced on the left, scroll to the very bottom, and click Edit Custom Lists.

  3. Click into the large List entries box and type the five buckets, each on its own line, pressing Enter after each: Current, then < 1 Month, then 1 Month, then 2 Months, then Older.

  4. Click Add, then OK, then OK again to close both windows.

  5. Back in the pivot table, right-click any bucket column heading, choose Sort, then Sort A to Z.

The columns will now read Current, < 1 Month, 1 Month, 2 Months, Older.

If they do not, right-click inside the pivot table, choose PivotTable Options, click the Totals and Filters tab, and make sure Use Custom Lists when sorting is ticked. Click OK and try point 5 above again.

Step 8: Running the report again later

Change the date in Settings B1, then click Data then Refresh All.

The buckets and totals update on their own. You do not need to repeat steps 1 to 7.

Optional: showing invoice numbers in their own column

The steps above give you one row per contact. If you want to see the individual invoices behind each contact balance, you can add the invoice number as a second row field.

By default Excel stacks row fields into a single indented column, which is hard to read and hard to copy elsewhere. The steps below give each field its own proper column.

Add the field

In the Rows box on the right of the screen, drag InvoiceNumber in underneath ContactName. The order in that box controls the order of the columns, so ContactName must sit above InvoiceNumber.

Split them into separate columns

  1. Click any cell inside the pivot table. Two extra green tabs appear at the end of the ribbon, PivotTable Analyze and Design.

  2. Click the Design tab.

  3. Click Report Layout, then Show in Tabular Form.

ContactName and InvoiceNumber will now sit in two separate columns.

Fill in the blank contact names

Contact names will only show on the first row of each group, leaving blanks underneath. To repeat the name on every row, click Report Layout again and choose Repeat All Item Labels.

This matters if you plan to sort, filter, or copy the results into another sheet, because blank cells break all three.

Remove the subtotal rows (optional)

Tabular Form adds a subtotal row after every contact. To remove them, click Subtotals on the Design tab and choose Do Not Show Subtotals.

Leave them switched on if you want a total per contact alongside the invoice detail.

Hide paid invoices

Once invoice numbers are in their own column, you can hide any invoice that has been fully paid or credited.

  1. Click the dropdown arrow on the InvoiceNumber column heading.

  2. At the top of the menu, check that Select field shows your invoice number field.

  3. Choose Value Filters, then Not Between.

  4. Pick Sum of NetAmount, then enter -0.01 in the first box and 0.01 in the second.

  5. Click OK.

Any invoice with a balance within one cent of zero is now hidden, leaving only genuinely outstanding items.

Troubleshooting

The dates look like 00:00.0

Select the DueDate and Date columns, then on the Home tab change the number format dropdown from General to Short Date. If they still do not display as dates after that, get in touch before going further.

The custom list does not follow the file to a colleague

Custom lists are saved in your own Excel installation, not inside the workbook. Anyone else opening the file will need to set up the list once themselves, using step 7.

Some rows show as zero

An invoice that has been fully paid or credited nets to zero, so it is expected to appear with a zero balance. See the optional section above for how to hide these.

A credit note is not cancelling out its invoice

Credit notes and payments carry their own document numbers, so they appear as separate rows rather than reducing the invoice they relate to. The contact total is still correct, but the individual rows may look odd. If a contact balance does not match what you expect, check that contact in Xero before relying on the figure.

Need help

Contact the dataSights team at hello@datasights.co.

dataSights

Try dataSights free

See how dataSights automates your Xero consolidation and reporting. Start your 14-day free trial, no credit card required.

Start for free