Forum Discussion
Saurav_Kaura
Oct 30, 2021Copper Contributor
'Else part' of if() is executed even if the condition mentioned is true.
Here i'm using if function to get value of age column.
formula used is: if (f2<100,100-f2+14,f2-14)
I am always getting answer from f2 -14 but the answer should come from 100-f2+14
Please help.
Herewith attached is my excel sheet.
8 Replies
- Yea_SoBronze Contributor
- SergeiBaklanDiamond Contributor
- Saurav_KauraCopper Contributor
Column f is formatted as general not text SergeiBaklan
- Riny_van_EekelenPlatinum Contributor
Saurav_Kaura Not sure I follow what you are trying to achieve, but is seems you calculate the age of cars counting from the year 2014. Correct?
If so, use the formula provided by SergeiBaklan in F2 and copy down and change the formula in G2 to
=IF(F2 > 14,100-F2+14,14-F2)and copy down, the ages will be as you would expect them to be.
- OliverScheurichGold Contributor
Column F is formatted as text. Enter this formula in F2 and copy down:
=NUMBERVALUE(MID(A2,3,2))