Forum Discussion

djufman253's avatar
djufman253
Copper Contributor
Mar 07, 2023

Excel

I have a list of food that the user will select from a drop down list. each food has a value. Based on the selection I want another cell to print this value.

For example: Cell A1: A10 has names of food. Cells B1: B10 and C1:C10 has values of protein and fats based on the food. In Cell D1 there is a drop-down list. The user selects rice. I want Cell E1 to show the amount of protein and cell F1 to show the amount of fats.

1 Reply

  • djufman253 

    In E1:

    =IFERROR(VLOOKUP(D1,$A$1:$C$10,2,FALSE),"")

    In F1:

    =IFERROR(VLOOKUP(D1,$A$1:$C$10,3,FALSE),"")

     

    If you have Microsoft 365 or Office 2021, you can enter this formula in E1. It will automatically spill to F1:

    =XLOOKUP(D1,$A$1:$A$10,$B$1:$C$10,"")

     

    All these formulas can be filled down if required.

Resources