lundi 26 août 2019

Condensing nested if-statements with multiple criteria

The blue columns is the data given and the red columns is what is being calculated. Then the table to the right is what I am referencing. So, F2 will be calculated by the following steps:

  1. Look at the Machinery column (D), if the cell contains LF, select column K, otherwise select column L
  2. Look at the Grade column (E), if the cell contains RG, select rows 4:8, otherwise select rows 9:12.
  3. Look at the Species column (A), if the cell contains MS, select rows 5 and 10, otherwise.......
  4. Where every the most selected cell is in columns K and L, copy into column F.
  5. Multiply column F by column C.

I don't want to make another column for my final result. I did in the picture to show the two steps separately. So column F should be the final answer (F2 = 107.33). The reference table can be formatted differently as well.

At first, I tried using nested-if statements, but realized that I would have like 20+ if statements for all the different outcomes. I think I would want to use the SEARCH function to find weather of not the cell contains a specific piece of information. Then I would probably use some sort of combination of match, if, v-lookup, index, search, but I am not sure how to condense these.

Any suggestion?

enter image description here

Aucun commentaire:

Enregistrer un commentaire