Oct 26 2020 06:02 AM
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.
Oct 26 2020 06:54 AM
SolutionIn 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.
Oct 26 2020 07:44 AM
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) )
Oct 27 2020 03:24 AM
@Hans Vogelaar Thanks for your help Hans, you have answered my question perfectly.
Oct 27 2020 03:26 AM
@Peter Bartholomew Thanks for your help Peter
Oct 27 2020 07:06 AM
@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
Oct 27 2020 07:12 AM
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.
Oct 28 2020 06:39 AM
@Hans Vogelaar Thanks very much for your help Hans
Oct 26 2020 06:54 AM
SolutionIn 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.