ID Height Phase Corrected_Height Final
1 0 A 0 0
2 1.2 A 1.2 1.2
3 3.9 A 3.9 3.9
4 5.8 A 5.8 5.8
5 4.6 A NA 7.7
6 7.7 A 7.7 9.3
7 9.3 A 9.3 10.8
..
300 237.5 P 237.5 ..
301 234.7 D 234.7 ..
302 233.3 D 233.3 ..
303 235.1 D NA ..
555 1.0 D 1.0
I have a set of data of similar structure. Calculation of the Phase column was done according to the formula =IF(B2=MAX(B:B);"P";IF(ROW(B2)<MATCH(MAX(B:B);B:B;0);"A";"D"))
thanks to @Scott Craner for the solution Naming a behavior in Excel
and to calculate the Corrected_Height column I used =IF(C4="A" & B4>B3;B4; IF(C4="D" & B4<B3;B4;"NA")))
. However I did not get the required result. The idea is when in "A" phase, should a lower value arise than the previous one it should change to NA and in "D" phase, should a value be higher than the previous one it should again change to NA. Any suggestion what should I change in the formula? And I also want a final column that gives me the values without NA in it. A,P,and D in phase means Ascent,Peak, and Descent.
The
&
operator cannot be used to logically and together two conditions in an Excel formula. Instead, use theAND()
function: