Coding IF statements in Excel

蓝咒 提交于 2019-12-24 20:16:35

问题


I have created a Risk Log in Excel, there are two columns, labels Priority & Impact (where High (H), Medium (M) or Low (L) can be inputted). I would like to create a third column called "Measure". This will calculate a value based on the priority and the impact of these risks. The numbers are shown in the table below, where the horizontal axis is Impact, and the Vertical in Priority

 H  3   7   9
 M  2   5   8
 L  1   4   6
    L   M   H
Impact

So for example, a priority of H and an impact of H would give you 9 in the measure column, a priority of M and an impact of H would give you 8, and a priority of H and an impact of M would give you 7. I am not quite sure how to code the "Measure" column so that I get the number desired. I am assuming some kind of "If" statement, but not sure as there are so many options. Below is my current spreadsheet, and I would like to add the measure column to the right.

Any help is great!


回答1:


This can be done with an Index/Match lookup. No nesting of IFs required.

=INDEX($B$1:$D$3,MATCH(F2,$A$1:$A$3,0),MATCH(G2,$B$4:$D$4,0))

Copy down. You can place the lookup table on a different sheet, of course.

The first Match function finds the row according to the values in A1 to A3. The second Match finds the column according to the values in B4 to D4. Index returns the cell where the found row and column cross.



来源:https://stackoverflow.com/questions/46963950/coding-if-statements-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!