Create an Excel Invoice Tracker for Multiple Customers and Vendors
Question details
Create an invoice tracker that stores customer, vendor, and invoice details separately and fills a single invoice template using an invoice ID.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A business needs to prepare invoices for multiple customers and vendors without manually copying the same information into each invoice.
- Observed behavior
- Selecting an invoice ID should display the associated customer, vendor, line items, and total on one reusable template.
Assign a unique ID to each customer, vendor, and invoice, and decide which details belong on the invoice. Check that your Excel version supports XLOOKUP and FILTER before using the formulas below.
Build linked Excel tables and populate an invoice template
Use this approach to maintain separate records and retrieve the correct customer, vendor, and line items by invoice ID.
Store one row per invoice in an invoice header table and one row per item in an invoice line table. Keep IDs consistent across tables so lookups can match the records.
On separate sheets, enter customer columns CustomerID and CustomerName; vendor columns VendorID and VendorName; invoice header columns InvoiceID, CustomerID, and VendorID; and invoice line columns InvoiceID, Description, Quantity, and UnitPrice. Select each range, choose Insert > Table, and name the tables Customers, Vendors, InvoiceHeaders, and InvoiceLines on the Table Design tab. Keep Description, Quantity, and UnitPrice adjacent in that order.
Create an Invoice Template sheet and enter an existing invoice ID in cell B2. Each InvoiceID should appear only once in InvoiceHeaders, although it can appear on multiple InvoiceLines rows.
In B4, enter =XLOOKUP(XLOOKUP($B$2,InvoiceHeaders[InvoiceID],InvoiceHeaders[CustomerID]),Customers[CustomerID],Customers[CustomerName],"Not found"). In B5, enter =XLOOKUP(XLOOKUP($B$2,InvoiceHeaders[InvoiceID],InvoiceHeaders[VendorID]),Vendors[VendorID],Vendors[VendorName],"Not found").
In B8, enter =FILTER(InvoiceLines[[Description]:[UnitPrice]],InvoiceLines[InvoiceID]=$B$2,"No matching lines"). Leave the cells below and to the right of B8 empty so the results can spill into them.
In B6, enter =SUMPRODUCT((InvoiceLines[InvoiceID]=$B$2)*InvoiceLines[Quantity]*InvoiceLines[UnitPrice]). Change B2 to another invoice ID and check that the names, lines, and total update.

Create a Reusable Invoice Tracker in WPS Spreadsheets
Use linked sheets, VLOOKUP, and an invoice-line helper key in WPS Spreadsheets to fill one invoice template for different customers and vendors.
- 1. Set up the sheets: Open WPS Spreadsheets and create sheets named Customers, Vendors, InvoiceHeaders, InvoiceLines, and Invoice Template. In row 1, use columns A:B for CustomerID and CustomerName on Customers, A:B for VendorID and VendorName on Vendors, and A:C for InvoiceID, CustomerID, and VendorID on InvoiceHeaders.
- 2. Add invoice lines and keys: On InvoiceLines, use columns A:E for InvoiceID, Description, Quantity, UnitPrice, and LineKey. In E2, enter =A2&"|"&COUNTIF($A$2:A2,A2), then fill it down alongside your line items. Enter one row per item and keep quantity and unit price numeric.
- 3. Select an invoice and retrieve names: On Invoice Template, enter an invoice ID in B2. In B4, enter =IFERROR(VLOOKUP(VLOOKUP($B$2,InvoiceHeaders!$A$2:$C$1000,2,FALSE),Customers!$A$2:$B$1000,2,FALSE),""). In B5, use =IFERROR(VLOOKUP(VLOOKUP($B$2,InvoiceHeaders!$A$2:$C$1000,3,FALSE),Vendors!$A$2:$B$1000,2,FALSE),"").
- 4. Retrieve the line items: In Invoice Template cell B8, enter =IFERROR(INDEX(InvoiceLines!B$2:B$1000,MATCH($B$2&"|"&ROWS($B$8:$B8),InvoiceLines!$E$2:$E$1000,0)),""). Copy B8 across through D8 and then down for enough rows to accommodate the invoice's items.
- 5. Add the total and test: In B6, enter =SUMPRODUCT((InvoiceLines!$A$2:$A$1000=$B$2)*InvoiceLines!$C$2:$C$1000*InvoiceLines!$D$2:$D$1000). Change B2 to another invoice ID and verify the results. Expand the formula ranges beyond row 1000 if your records exceed that row.

Frequently Asked Questions
Can one invoice have multiple line items?
Yes. Add a separate InvoiceLines row for each item and repeat the same InvoiceID. FILTER returns all matching rows to the template.
Why does the invoice template show a lookup error?
Check that B2 contains an InvoiceID from InvoiceHeaders and that the header's CustomerID and VendorID match entries in the Customers and Vendors tables. IDs stored as text may not match numeric IDs.
Why does FILTER show a spill error?
Clear any content in the cells below and to the right of the FILTER formula in B8. The results need an empty range in which to expand.
What if my Excel version does not support XLOOKUP or FILTER?
Use VLOOKUP for customer and vendor names and an INDEX/MATCH helper-key approach for line items, as shown in the WPS Spreadsheets steps. These formulas can also be used in Excel.
Does the example total include tax or shipping?
No. The SUMPRODUCT formula adds quantity multiplied by unit price for the selected invoice. Add separate cells and formulas for tax, discounts, or shipping if needed.




