All You Need Is SWITCH
I don't think I've seen this discussed before, so I apologize if I am rehashing old material. I did a cursory search and found nothing.
For a decade now, I've argued you should always use COUNT/SUM/MAX/MINIFS instead of COUNTIF because you never know when you'll need additional conditions. In present times, we don't even need COUNTIFS/RACON functions because you can do the same thing with array formulas although COUNTIFS is easier to type, IMO.
So when a week or two ago I learned you can do the same thing as IFS with SWITCH. This got me to thinking... based on the COUNTIFS principle I'm whimsically calling "the condition of sufficient conditions is always conditional"... I'm thinking the meta is to always use SWITCH instead of IF or IFS. This would be a very hard habit to form as I've used more IF statements than Diddy used bottles of baby oil, but let's be aspirational.
Now, the SWITCH version of your basic Hot Dog/Not Hot Dog IF is I think the same amount keystrokes (with tab completion), so I'm calling that a win. I'll grant that the IFS version of multiple logical operators is more "straightforward" or even "intuitive" if you're reading an online tutorial on multi-conditionals, but if you want one function-ring to rule them all and in the darkness gut em like a fish, then ALL YOU NEED IS SWITCH.
=SWITCH(A1,"Hot Dog","Hot Dog","Not Hot Dog") =IF(A1="Hot Dog","Hot Dog","Not Hot Dog") Now, being a rational being, let's consider the downsides.
- Backwards Compatibility / No One Understands What The Hell You Are Doing
- Backwards compatibility needs are typically a foreseeable binary so... whatever, my condolences if you don't get to live in 365 function utopia.
- If you need other people to understand what you are doing this may be a bad habit to form.
- File Size Bloat Cuz You've Become A SWITCHaholic
- You keep adding conditions and dragging down formulas because you've committed to an absolutist and universalist vision of SWITCH as the one true function and forgot that after 3 conditions for sure you should just make a lookup table and only store the reference data once.
Anyways, interested to hear anyone else's thoughts even if you just tell me this is the ramblings of a mad man.
Edit for posterity:
Additional Significant Downside(s)
- Inefficient branching computation issues which also causes incompatibility with recursive LAMBDAs
[link] [comments]
Want to read more?
Check out the full article on the original site