SOLVED

Comparing a price list to an invoice

Copper Contributor

Hi,

I have a price list & an invoice both of which are very long, the supplier is charging more for some items on their invoice than agreed in the price list but not all items, I would like a formula that I can use in column J to find out how much they are over charging, any help with this is much appreciated. The descriptions may vary on the invoice but the item ref's in columns A & E are the same for both the price list & invoice.

 

Ian955_0-1603717002052.png

 

7 Replies
best response confirmed by Ian955 (Copper Contributor)
Solution

@Ian955 

In J4:

=H4-VLOOKUP(E4,$A$4:$C$8,3,FALSE)

if you want to compare the prices, or

=G4*(H4-VLOOKUP(E4,$A$4:$C$8,3,FALSE))

if you want to calculate the overcharge on the total.

Adjust the range, then fill down.

@Ian955 

If you can guarantee that your item IDs are both reliable and are the natural numbers starting at 1 you do not even need to search for the price; it is given by

= INDEX(Prices[Price], [@[Item Ref]])

More generally you  will need a lookup based upon the product name or ID to give the agreed price and hence the overcharge, In the latest versions of Excel 365 the formula for the total overcharge could be expressed

= LET(
  priceCharged, Invoice[Price],
  quanitiy, Invoice[Quantity],
  agreedPrice, XLOOKUP(Invoice[Description], Prices[Description], Prices[Price]),
  overcharge, (priceCharged - agreedPrice) * quanitiy,
  SUM(overcharge) )

 

@Hans Vogelaar Thanks for your help Hans, you have answered my question perfectly.

@Peter Bartholomew Thanks for your help Peter

@Hans Vogelaar Hi Hans, this worked perfectly on the exercise, I'm trying to use it in my actual spreadsheet, what does the 3 before the word false relate to?

Thanks

Ian

@Ian955 

In VLOOKUP(E4,$A$4:$C$8,3,FALSE):

E4 is the cell whose value you want to search for.

$A$4:$C$8 is the lookup range. VLOOKUP searches its first column $A$4:$A$8 for the value of E4.

3 is the number of the column to return a result from - in this example column C.

FALSE means that Excel looks for an exact match.

@Hans Vogelaar  Thanks very much for your help Hans

1 best response

Accepted Solutions
best response confirmed by Ian955 (Copper Contributor)
Solution

@Ian955 

In J4:

=H4-VLOOKUP(E4,$A$4:$C$8,3,FALSE)

if you want to compare the prices, or

=G4*(H4-VLOOKUP(E4,$A$4:$C$8,3,FALSE))

if you want to calculate the overcharge on the total.

Adjust the range, then fill down.

View solution in original post