ME, STRANGE SUMMATION

B

Berj

Hi,

I can have the number 1 in several cells in a range of cells A1 to Z1, but
it is always filled starting from cell A1 and gradually to the right. May
also skip some cells.
Ex.
A1 to C1 may be blank, D1 is 1, then E1 to J1 is blank, then K1 is 1, and so
on.
I need a formula which adds up these 1s to the last position where a 1 is
found.

Summing up the cells till Z1 is not an option, since later, in another
formula I will find the sum of all the 1s AFTER the last 1 which was summed
up in the first formula.
This second formula will be relatively easy after I get the first formula.

I hope this was well understood.

Thanks in advance guys.
Berj
 
B

Bob Phillips

I am not sure I get why, but try this array formula

=SUM(A1:INDEX(A1:Z1,,MIN(IF((A1:Z1<>"")*(A1:Z1<>1),COLUMN(A1:Z1)))-1))
 
R

Ragdyer

Try this:

=SUM(A1:INDEX(A1:Z1,MATCH(99^99,A1:Z1)))

This totals to the last numeric cell.

Same result as
=Sum(A1:Z1)

Care to share your reason why the simple Sum formula does not work for you?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top