How to Compare Excel Prices for Base Products and Variants
Question details
Match variant product numbers with base product numbers to compare prices across different worksheets, even when the sheets are not in the same order.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Comparing unique base product prices in one sheet against corresponding variant prices in another sheet to identify pricing matches or discrepancies.
- Observed behavior
- Retrieving and comparing prices dynamically to display TRUE/FALSE matching statuses or using conditional formatting to highlight differences.
Ensure that your base product numbers follow a consistent naming convention (like a fixed character length) and that both your base and variant pricing sheets are located in the same workbook.
Use VLOOKUP and LEFT Formulas for Comparison
Extract the base product number from the variant string using the LEFT function, then use VLOOKUP to compare the base price with the variant price.
This method works best when your base product numbers have a fixed length. By nesting the LEFT function inside VLOOKUP, you can extract the base identifier from the variant SKU and match it against the base pricing table.
Determine how many characters make up the base product number. For example, if the base number is always 5 characters long, you will use 5 in your LEFT function.
Select the cell where you want the result. Type the formula: =IFERROR(VLOOKUP(A2,Sheet2!$A$2:$B$8,2,0)=VLOOKUP(LEFT(A2,5),Sheet1!$A$2:$C$4,3,0),"")
Press Enter, then click and drag the fill handle down to apply this formula to all other variant products in your list. It will return TRUE if prices match and FALSE if they do not.

Use an IF Statement with VLOOKUP for Explicit Text Output
Wrap your VLOOKUP comparison inside an IF statement to explicitly return a specific text string like "Match" or "Mismatch", or "TRUE" and "FALSE".
Compare Product Variants and Prices Effortlessly in WPS Office
WPS Spreadsheet provides robust support for all major lookup and reference formulas including VLOOKUP, XLOOKUP, and IF. You can easily analyze, compare, and highlight product price discrepancies across massive datasets without any lag.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your base and variant product sheets.
- 2. Select a blank cell: Click on the first empty cell in the column where you want your price comparison results to appear.
- 3. Insert the lookup formula: Type your combined VLOOKUP and LEFT formula in the formula bar, referencing your specific base and variant data arrays.
- 4. Drag to fill: Press Enter, then double-click the small square at the bottom-right corner of the cell to autofill the comparison formula down the entire list.

Frequently Asked Questions
Why is my VLOOKUP returning an #N/A error when comparing prices?
The #N/A error occurs when Excel cannot find the lookup value in your source array. This often happens if the variant or base numbers have trailing spaces, if the text formatting differs, or if the product simply does not exist in the referenced sheet.
Can I use XLOOKUP instead of VLOOKUP for comparing base and variant prices?
Yes. XLOOKUP is generally more flexible than VLOOKUP. It allows you to search in any column regardless of its position and provides a built-in 'if not found' argument, eliminating the need to wrap your formula in IFERROR.
How do I highlight the price mismatches automatically?
You can use Conditional Formatting. Select the column with your TRUE/FALSE formula results, go to Conditional Formatting > Highlight Cells Rules > Equal To, and set the rule to format cells containing "FALSE" with a red fill.
What if my base product number varies in length?
If your base product number does not have a fixed length, the standard LEFT(A2, 5) formula will not work. You will need to use a combination of LEFT and FIND functions to extract characters up to a specific delimiter, such as a hyphen or space.




