Easy way to make highly nested conditionals
Posted: Fri Jan 19, 2018 11:57 pm
I've been working with OpenOffice Calc for a while now, and found myself wanting to process some data that required a lot of if-then-else type conditions.
I found the edit-in-cell [Ctrl][Enter] trick to add line breaks in the formula to make it more readable, but something caught my eye and I had an "aha!" moment.
The only real condition you're focusing writing in the current cell is the IF portion. Else could be the result of some other test in another cell.
And that could go on an on, chaining them together.
So I "stacked" the conditional cells, and the added benefit of this was that by just copying the formula up one cell, another layer could be added to the nested conditional.
Delete the top cells, and the outer layer of the nest is removed. Super simple.
I made a little spreadsheet to demonstrate.
Questions, comments, constructive criticism, and improvements are most welcome.
I found the edit-in-cell [Ctrl][Enter] trick to add line breaks in the formula to make it more readable, but something caught my eye and I had an "aha!" moment.
The only real condition you're focusing writing in the current cell is the IF portion. Else could be the result of some other test in another cell.
And that could go on an on, chaining them together.
So I "stacked" the conditional cells, and the added benefit of this was that by just copying the formula up one cell, another layer could be added to the nested conditional.
Delete the top cells, and the outer layer of the nest is removed. Super simple.
I made a little spreadsheet to demonstrate.
Questions, comments, constructive criticism, and improvements are most welcome.