This is an Excel formula with nested IF statements:
=IF((B2="East"),4,IF((B2="West"),3,IF((B2="North"),2,IF((B2="South"),1,""))))
To essentially accomplish this:
If cell B2 = "East"
return "4"
ElseIf cell B2 = "West"
return "3"
ElseIf cell B2 = "North"
return "2"
ElseIf cell B2 = "South"
return "1"
Else
return ""
Can Excel formulas be written in such a "more readable" manner and converted to the official syntax? Is there any tool to help write Excel formulas?
This may be a "superuser" question ... but only programmers might know the answer!
Excel Formula Formatter add-in by Rob van Gelder, mentioned at Daily Dose of Excel.
Excel's formula bar ignores line feeds and white space, so you can Alt+Enter and spacebar to format the formulas however you like. I've tried it and I quickly stopped doing it. Too much spacebar-ing, especially if you need to edit.