Forum Discussion
Will I save resource when adding an If function before complicated functions?
Not exactly. Let say we have formula
=IF(A1=TRUE, AVERAGE(SORT(UNIQUE(SEQUENCE(100000,500)))),0)
It takes couple of seconds to generate result if in A1 is TRUE. If we change on FALSE, zero will be returned immediately.
However, if we remove AVERAGE() and formula returns big enough spill, changing TRUE on FALSE could take even more time than direct calculation - Excel cleans the grid removing that spill.
With
=IFS(A1=TRUE, AVERAGE(SORT(UNIQUE(SEQUENCE(100000,500)))),TRUE, 0)
both TRUE and FALSE take about couple of seconds to return result.
Sorry let me clarify. If the conditional is an array. So if we tweak your example:
=IF(A1:A2=TRUE, AVERAGE(SORT(UNIQUE(SEQUENCE(100000,500)))),0)
Even if BOTH A1&A2 are False it will still take a second or so to calculate
- SergeiBaklanAug 23, 2025Diamond Contributor
Oh, yes m_tarler​ , you are right. With array of conditions it first evaluates each expression and after that builds array of results depends on values in conditions array. With only exception of single element of conditions array, e.g. ={FALSE} in A1.