Hi all, first time poster so hoping someone can assist!
I have two tables: a table of transactions and a pricing table for both June and September. We're trying to establish whether the price since June has increased enough to cover additional costs (from Brexit price rises).
So if Customer A was paying £10.00/kg for a product back in June, the June pricebook will say £10.00/kg. But then the account managers were under instructions to increase prices by 7% across the board, so the September price should be £10.70/kg. If the price hasn't increased by 7%, we need to calculate how much we've lost as a result of that.
Normally that would be fairly easy, but the problem is that each customer / product combination could have a pricebreak for different quantity sold. So for that example above, maybe if they purchase 25kg they get £10.00/kg, but if they purchase 25kg-1000kg it's £8.00/kg, 1000kg-3000kg it's £6.00/kg and so on. And the pricebook for June and September have the price breaks running vertically, so if I do a VLOOKUP finding a customer / product combination, it finds the first entry and returns that value (£10.00/kg) but it could be that that customer purchased 2000kg and it should be returning the £6.00/kg price.
Basically I need the formula to be able to VLOOKUP the customer / product combination (column A in "Invoice Data"), and then look in the quantity column (column I in "Invoice Data") and find what the quantity break is, and only then return the price quoted (from column H in "June" and "September"). The results will populate into column K and L on "Invoice Data" and I'll reconcile the difference from there. It will need to be able to look if the quantity is between each figure, as it may not be an exact match of quantity.
As an example, on invoice 504564, Customer A purchased 100kg of Product A. Pricing in June was £21.91/kg, pricing in September is £21.91/kg (but should have been £23.44/kg). Based on that, we've lost £1.53/kg or £153.00 on that transaction. But the formula has to be able to look at the different pricing by quantity (so if they'd ordered 400kg, it would have given a different price for both months).
I've spoken to people more knowledgeable than I and they've mentioned I might need an array formula which I'm unfamiliar with. Right now I have a mammoth formula (below) which is working for the majority of the data, but if the quantity sold is larger than the largest price break, it brings up results from other customer / product combinations.
Current Formula:
=IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0))),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+1)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+1),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+2)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+2),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+3)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+3),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+4)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+4),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+5)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+5),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+6)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+6),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+7)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+7),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+8)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+8),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+9)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+9),
IF(I2>=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+10)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+10))))))))))))
Hopefully this makes sense, but if you need any further information please let me know!
I have two tables: a table of transactions and a pricing table for both June and September. We're trying to establish whether the price since June has increased enough to cover additional costs (from Brexit price rises).
So if Customer A was paying £10.00/kg for a product back in June, the June pricebook will say £10.00/kg. But then the account managers were under instructions to increase prices by 7% across the board, so the September price should be £10.70/kg. If the price hasn't increased by 7%, we need to calculate how much we've lost as a result of that.
Normally that would be fairly easy, but the problem is that each customer / product combination could have a pricebreak for different quantity sold. So for that example above, maybe if they purchase 25kg they get £10.00/kg, but if they purchase 25kg-1000kg it's £8.00/kg, 1000kg-3000kg it's £6.00/kg and so on. And the pricebook for June and September have the price breaks running vertically, so if I do a VLOOKUP finding a customer / product combination, it finds the first entry and returns that value (£10.00/kg) but it could be that that customer purchased 2000kg and it should be returning the £6.00/kg price.
Basically I need the formula to be able to VLOOKUP the customer / product combination (column A in "Invoice Data"), and then look in the quantity column (column I in "Invoice Data") and find what the quantity break is, and only then return the price quoted (from column H in "June" and "September"). The results will populate into column K and L on "Invoice Data" and I'll reconcile the difference from there. It will need to be able to look if the quantity is between each figure, as it may not be an exact match of quantity.
As an example, on invoice 504564, Customer A purchased 100kg of Product A. Pricing in June was £21.91/kg, pricing in September is £21.91/kg (but should have been £23.44/kg). Based on that, we've lost £1.53/kg or £153.00 on that transaction. But the formula has to be able to look at the different pricing by quantity (so if they'd ordered 400kg, it would have given a different price for both months).
I've spoken to people more knowledgeable than I and they've mentioned I might need an array formula which I'm unfamiliar with. Right now I have a mammoth formula (below) which is working for the majority of the data, but if the quantity sold is larger than the largest price break, it brings up results from other customer / product combinations.
Current Formula:
=IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0))),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+1)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+1),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+2)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+2),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+3)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+3),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+4)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+4),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+5)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+5),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+6)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+6),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+7)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+7),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+8)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+8),
IF(I2<=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+9)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+9),
IF(I2>=(INDEX(June!$F$2:$F$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+10)),INDEX(June!$H$2:$H$135,MATCH('Invoice Data'!A2,June!$A$2:$A$135,0)+10))))))))))))
Hopefully this makes sense, but if you need any further information please let me know!