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. H...
SergeiBaklan
Oct 30, 2021Diamond Contributor
- Saurav_KauraOct 30, 2021Copper Contributor
Column f is formatted as general not text SergeiBaklan
- Riny_van_EekelenOct 31, 2021Platinum 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.
- SergeiBaklanOct 30, 2021Diamond Contributor
It could be formatted as General, but MID() returns texts, thus values are considered as texts. You may check by ISTEXT() on cell from any empty one.
- Saurav_KauraOct 31, 2021Copper ContributorI have a doubt that how text format can be shown as general format in excel. Excel should show text format instead of general.