Naming a behavior in Excel

2019-07-10 07:57发布

I have a dataset on height that looks like below.

Height Phase
0      A
2      A
3      A
4      P
4      P
3      D
2      D
1      D
0      D .

I want to create a second column called Phase as above that tells Ascent, Peak, or Descent at corresponding height. I tried to use the IF function as IF(HeiPh="A",B3>=B2,IF(HeiPh="P",4,"D")) . However i'm not getting the required result. I have a big dataset and there are height that is same for few times i.e. like 0 2 2 3 4 5 5 5 5 6 and so on

2条回答
做个烂人
2楼-- · 2019-07-10 08:19

Try this:

=IF(A2=MAX(A:A),"P",IF(ROW(A2)<MATCH(MAX(A:A),A:A,0),"A","D"))

enter image description here

查看更多
家丑人穷心不美
3楼-- · 2019-07-10 08:24

You can do this =IF(MAX($A$4:$A$13)=A4,"P",IFS(A5>=A4,"A",A5<A4,"D"))

https://i.stack.imgur.com/Q7qyz.png

查看更多
登录 后发表回答