Amending an existing formual to improve grammar
On May 29, 4:41*pm, Colin Hayes wrote:
="Totals (" & COUNTA(C6:C17)
& IF(COUNTA(C6:C17)=1," Month)"," Months)")
[....]
I agree that "Totals (0 Months)" is correct but looks odd.
I suppose an improvement would be if it just said "Totals",
or better still if it were blank where entries are yet to
be made in the cells C6:C17.
=IF(COUNTA(C6:C17)=0, "",
"Totals (" & COUNTA(C6:C17)
& IF(COUNTA(C6:C17)=1," Month)"," Months)"))
Caveat: If any of C6:C17 displays the null string (""), as this
formula does sometimes, COUNTA(C6:C17) will not be zero. If you would
like null strings not to be counted (because the cell looks blank),
try:
=IF(SUMPRODUCT(--(C6:C17<""))=0, "",
"Totals (" & SUMPRODUCT(--(C6:C17<""))
& IF(COUNTA(C6:C17)=1," Month)"," Months)"))
The double-negative (--) converts TRUE and FALSE to 1 and 0, which
SUMPRODUCT requires.
|