Forum Discussion
bramleyas
Feb 06, 2025Copper Contributor
Checkboxes not automatically updating using COUNTIF
Hey, all, I'm using the following function to set the checkbox boolean of a cell based on the amount of other cells checked: In cell A1: =IF(COUNTIF(A2:A3=2,TRUE),TRUE,FALSE) The formula works, bu...
m_tarler
Feb 07, 2025Silver Contributor
I assume the formula you meant to use is:
=IF(COUNTIF(B2:B3,TRUE)=2,TRUE,FALSE)and there does seem to be something buggy in the online version. It works fine in the desktop version but online I can literally see it toggle and then revert back to the incorrect answer.
Although not great, by adding OFFSET() (which is a 'volatile function') it does seem to "fix" the problem:
=IF(COUNTIF(OFFSET(B2:B3,0,0),TRUE)=2,TRUE,FALSE)You should also report the bug to MS and hopefully they can figure it out and fix it.
Intersestingly enough this gives me an opportunity to investigate Volatile functions. For example any of the following also work (i.e. are volatile) as expected:
=IF(AND(B2,B3)+0*RAND(),TRUE,FALSE)
=IF(AND(B2,B3)+0*NOW(),TRUE,FALSE)
=IF(AND(B2,B3)+0*TODAY(),TRUE,FALSE)
=IF(AND(B2,B3)+0*RAND(),TRUE,FALSE)
and using INDEX() in the following case does not act as volatile:
=IF(AND(INDEX(B2:B3,0)),TRUE,FALSE)
but using INDEX() to help define a range in the following DOES act volatile:
=IF(AND(B2:INDEX(B3,1))+0,TRUE,FALSE)
Similar is true for TAKE()
=IF(AND(TAKE(B2:B6,2)),TRUE,FALSE) <= not volatile
=IF(AND(B2:TAKE(B3,1)),TRUE,FALSE) <= volatile