Sum of last few available lines with data

monaldo12

New Member
Joined
Mar 17, 2016
Messages
45
Hi,

Basically very simple for you. I need a help with a formula that can sum up the last three fields:

10 0 10 0 10

Sum of last three should be 20, so it has to take zero's into account. However, my searching field won't be filled in till the last line:

10 0 10 10 10 . .

So Sum should be just 30, the dots will be empty. So where their is an empty space I need it to look further back, where there are zero's it needs to take them into account.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Use this array formula(Confirm with Ctrl-Shift-Enter):

=SUM(Z1:INDEX(A1:Z1,LARGE(COLUMN(A1:Z1)*(A1:Z1<>""),3)))

Note: In this example I'm assuming there are no values further than column Z, if there are, adjust accordingly.
 
Upvote 0
Use this array formula(Confirm with Ctrl-Shift-Enter):

=SUM(Z1:INDEX(A1:Z1,LARGE(COLUMN(A1:Z1)*(A1:Z1<>""),3)))

Note: In this example I'm assuming there are no values further than column Z, if there are, adjust accordingly.

Hmm doesn't seem to work, outcome is zero. Even if I fill in some numbers for example in Y1 and Z1.....
 
Upvote 0
The formula definitely works, must be something else. Could you copy-paste row 1 here?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top