How to calculate a value based on multiple criteria

GrumpyChi

New Member
Joined
Nov 22, 2021
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I have a data set which as an example has the below information in it


Invoice number / charge type (FULL or DISCOUNT) / Total Volume / Total Charge
1461615 FULL 100 50
1461615 DISCOUNT 100 -10
252656 FULL 150 21

So for invoice 1461615 on the discount line, I need to calculate the unit cost which is the total charge divided by the total volume but using the FULL line

I can't figure out how to do this. I've tried SUMPRODUCT but it's returning the value for the discount line unit cost which is not what I need

Thank you
 
Hi Fluff, I am getting an error of the first argument of LET must be a valid name
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Are you using an English language version of Excel?
 
Upvote 0
In that case I don't see why you get hat error, try changing it like
Excel Formula:
=LET(xyz,XMATCH(A2,A$1:A1,0,-1),IF(B2="discount",INDEX(E$1:E1,xyz)/INDEX(D$1:D1,xyz),""))
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top