I am looking for a way where I can look up a value based on a value in another cell. In my case i have a scell that holds a sales value and i need to know what the cost would be based in which range it falls in. I know i could do it via endles if statments but i hope there is a way where i can poot on a separate sheet a table in th enclosed pic and the formula would look up which range it would fall under and return the correct charge for the passed in value.
so for example if i pass 620.000 to this function it should return 800 since it is >= to 600.000 and <= 799.999
CodePudding user response:
Try this:
=vlookup(d1,a2:c8,3,1)
Assuming the 620 you suggest is in cell d1.
Also cell A2 needs a 0 not -
With index() and match():
=index(c2:c8,match(d1,a2:a8,1))
CodePudding user response:
Sharing two more alternatives,
• OLDSKOOL Approach --> LOOKUP()
Function
=LOOKUP(A10,A2:C8)
• Modern O365 Approach --> XLOOKUP()
Function
=XLOOKUP(A10,A2:A8,C2:C8,"None",-1)