15. Exercise - COUNTBLANK Function


Prerequisites

You should read the Excel Functions course up to the chapter on COUNTIF, COUNTIFS, SUMIF and SUMIFS functions before starting this exercise.

Question

We take the example from Exercise 4 - Calculation, Formulas and Series and Exercise 2 – Logical functions.

We have filled in columns F to I using 4 formulas. In cell F5 :

=IF(B5="","",SUM($B5:B5))

In cell G5 :

=IF(OR(B5="",C5=""),"",SUM($B5:C5))

In cell H5 :

=IF(OR(B5="",C5="",D5=""),"",SUM($B5:D5))

In cell I5 :

=IF(OR(B5="",C5="",D5="",E5=""),"",SUM($B5:E5))

Now write a single formula in cell F5 to copy it to the range F5:I5 and then copy it to the last row of the sheet.


Indications Exercise – COUNTBLANK Function


We use the COUNTBLANK function which returns the number of empty cells in a range of cells.

The formula in cell B5 is :

 

=IF(COUNTBLANK($B5:B5)>0,"",SUM($B5:B5))


<< 14. Exercise – COUNTIF, COUNTIFS, SUMIF and SUMIFS functions

16. Exercise - VLOOKUP and HLOOKUP functions >>