简体   繁体   中英

code to find the sum of continuous non-empty cells in a column in excel till the empty cell occurs?

在此处输入图片说明

In B1 I want to sum all the cells of first column till the empty cell occurs.

Use this:

=SUM(A1:INDEX(A:A,MATCH(1E+99,A:A)))

The INDEX/MATCH formula finds the last cell that has a numeric value and sets that as the end of the Range in the SUM() formula.

But ultimately if you want to sum every number in Column A then a simple Sum of the whole column will work:

=SUM(A:A)

The SUM() Function ignores text and blank cells.

If what is wanted is to sum till the first blank cell and there is data after that then use this instead:

=SUM(A1:INDEX(A:A,MATCH(TRUE,INDEX(A:A="",0),0)))

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM