Function Problems

How to Transfer Product Quantities and Codes to an Excel Invoice

Phi Hung VoPhi Hung Vo Nov 3, 2026 868 views

Question details

Build an automated Excel invoice using product codes, quantities, and lookup formulas to retrieve prices and calculate line totals.

How to Automate an Excel Invoice with Product Codes and VLOOKUP
Product
Excel
Device & OS
not provided
Scenario
Creating an efficient invoice template where entering a product code automatically populates the item description and price.
Observed behavior
Manual data entry is currently required for descriptions and prices, leading to slow processing times and calculation errors.
Before you start

Ensure you have a normalized price list or product database set up in a separate worksheet within your workbook, featuring clear columns for product codes, descriptions, and unit prices.

Solution 1Recommended

Use VLOOKUP and Data Validation to Automate the Invoice

Create a drop-down list for product codes and use the VLOOKUP function to automatically fetch product descriptions and prices based on the selected code.

This method involves setting up a structured product database and using standard lookup formulas. By implementing Data Validation, you ensure that only valid product codes are entered, reducing errors.

1
Set up your product database

Create a new worksheet named 'Products'. In columns A, B, and C, enter your Product Codes, Descriptions, and Retail Prices respectively.

2
Create a drop-down list for product codes

Go to your Invoice worksheet. Select the cells where product codes will be entered. Click on the 'Data' tab, select 'Data Validation', choose 'List' under the Allow criteria, and select the Product Code column from your 'Products' sheet.

3
Apply the VLOOKUP formula for descriptions

In the Description column of your invoice, enter the formula: =VLOOKUP(A2, Products!A:C, 2, FALSE). This tells Excel to look for the code in cell A2 and return the exact match from the second column of your product list.

4
Apply the VLOOKUP formula for prices

In the Unit Price column of your invoice, enter: =VLOOKUP(A2, Products!A:C, 3, FALSE). This retrieves the price from the third column of the product database.

5
Calculate the line total

In the Total column, enter the formula: =QuantityCell * PriceCell (e.g., =B2*D2) to multiply the manually entered quantity by the automatically fetched unit price.

Use VLOOKUP and Data Validation to Automate the Invoice
Automation Complete: Your invoice will now automatically populate product details and line totals as soon as a product code and quantity are entered.
Build Invoices Easily

Automate Your Spreadsheets with WPS Office

WPS Spreadsheet provides powerful built-in functions like VLOOKUP, XLOOKUP, and Data Validation to help you build automated, error-free invoices quickly and accurately.

  1. 1. Create your workbook: Open WPS Spreadsheet and create a new blank workbook to serve as your automated invoice.
  2. 2. Set up your database: Input your product codes, descriptions, and prices into 'Sheet2'.
  3. 3. Apply Data Validation: On your invoice template in 'Sheet1', navigate to the 'Data' tab and click 'Validation' to create drop-down menus for your product codes.
  4. 4. Insert lookup formulas: Use standard VLOOKUP or XLOOKUP formulas exactly as you would in Microsoft Excel to automatically pull in your product details.
Fully compatible with Microsoft Excel file formats (.xlsx and .xls).Built-in advanced formulas like VLOOKUP, XLOOKUP, and IF for complex invoice calculations.Free, lightweight, and features a familiar user interface for a seamless transition.Cross-platform support for Windows, Mac, Linux, iOS, and Android.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my VLOOKUP formula returning an #N/A error on the invoice?

The #N/A error usually occurs when the product code entered on the invoice cannot be found in the first column of your product list. Ensure that there are no trailing spaces and that the data formats (text versus numbers) match exactly in both sheets.

How do I keep the invoice cells blank when no product code is selected?

You can wrap your VLOOKUP formula in an IFERROR function. Use the formula: =IFERROR(VLOOKUP(A2, Products!A:C, 2, FALSE), ""). This will display a blank cell instead of an error message when a product code is not yet selected.

Can I look up a product price using multiple criteria, such as item code and color?

Yes. While standard VLOOKUP only handles a single criterion, you can use XLOOKUP with concatenated criteria. For example, use =XLOOKUP(CodeCell&ColorCell, ProductCodes&ProductColors, Prices) to fetch details based on both the item code and its color.