The formula shown here uses Excel’s COUNTA function together with the INDEX function to create a dynamic range to count.

The INDEX function is used to provide a cell reference to the COUNTA function for the position of the top range as well as the position of the bottom range for each subset.

Excel’s MATCH function is used to look for or match for the first non empty cell (non blank cell) to provide the location of the top cell address and then the MATCH function is used again to match for the first empty cell to provide that address for the bottom of the range to the COUNTA function.

Leila Gharani

I'm a 5x Microsoft MVP with over 15 years of experience implementing and professionals on Management Information Systems of different sizes and nature.

My background is Masters in Economics, Economist, Consultant, Oracle HFM Accounting Systems Expert, SAP BW Project Manager. My passion is teaching, experimenting and sharing. I am also addicted to learning and enjoy taking online courses on a variety of topics.