Excel, if Excel cell is X, Y or Z then display 1,

2019-08-24 04:48发布

I need help with code for excel.

What I need is if a cell contains "Achieved" then display 1, "Partially Achieved" display 2 and if "Not Achieved" display 3.

Can someone help with what I need to enter?

Thanks

4条回答
甜甜的少女心
2楼-- · 2019-08-24 05:03
=IF(A1="Achieved",1,IF(A1="Partially Achieved",2,IF(A1="Not Achieved",3,"NA")))

enter image description here

查看更多
女痞
3楼-- · 2019-08-24 05:04
=SWITCH(A1,"Achieved",1,"Partially Achieved",2,"Not Achieved",3)

Where A1 is the cell you want to check of course.

查看更多
\"骚年 ilove
4楼-- · 2019-08-24 05:05

Try,

=iferror(match(A1, {"Achieved", "Partially Achieved", "Not Achieved"}, 0), "")

fwiw, to perform the reverse (with 1, 2 or 3 in a cell) use,

=iferror(choose(A1, "Achieved", "Partially Achieved", "Not Achieved"), "")
查看更多
beautiful°
5楼-- · 2019-08-24 05:11

For those without SWITCH (and half the length):

=MATCH(LEFT(A1),{"A","P","N"},0)
查看更多
登录 后发表回答