Home » excel » Complex lookup in Excel

Complex lookup in Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a worksheet which contains a list of parameters ‘Parameters’:

A            | B            | C          | D        | E          |
Manufacturer | Item Type    | Price From | Price To | Percentage |
Apple        | Mobile Phone | 0.00       | 99.99    | 50%        |
Apple        | Mobile Phone | 100.00     | 149.99   | 45%        |
Apple        | Tablet       | 0.00       | 99.99    | 65%        |

I have another worksheet which contains a list of retail items ‘Retail Stock’:

A            | B            | C              | D            |
Manufacturer | Item Type    | Purchase Price | Retail Price |
Apple        | Mobile Phone | 80.00          | ?            |
Apple        | Mobile Phone | 120.00         | ?            |
Apple        | Tablet       | 95.00          | ?            |

What I need to do in column D of ‘Retail Stock’ Worksheet, I need to pull back the relevant Percentage from the parameters worksheet in order to work out the Retail Price.

To find the percentage I need to do a lookup on Parameters worksheet, passing Manufacturer, Item Type and Purchase Price.

Please can someone advise on this,
I appreciate my question may need more padding to get the right answer, so if you need any more information, please ask.

How to&Answers:

You could use SUMIFS:

=SUMIFS(Parameters!E:E,Parameters!A:A,A2,Parameters!B:B,B2,Parameters!C:C,"<="&C2,Parameters!D:D,">="&C2)

I don’t think there can be overlaps in prices as this wouldn’t make much sense to me, so the above should give you the appropriate percentage.

Format as appropriate.

Note: If there is no match, then the function will return 0.


SUMIFS will take the sum from the column E of Parameters, provided that:

  • Column A is equal to A2,
  • Column B is equal to B2,
  • Column C is below C2,
  • Column D is above C2

Answer:

here will only ever be one match, there will be no overlap in parameters

Try this one:

=SUMPRODUCT((Parameters!$A$2:$A$100=A2)*
            (Parameters!$B$2:$B$100=B2)*
            (C2>=Parameters!$C$2:$C$100)*
            (C2<=Parameters!$D$2:$D$100)*
            (Parameters!$E$2:$E$100)
           )

for non matching rows formula returns 0