SUM FIRST 12 COLUMNS OF DATA FOR EACH ROW

i have 300 rows

each row has 12-60 columns of data in it, but each row has a different starting column . i need to create a new column, B, and put the sum of the first 12 columns with data into it.

must ignore cells that have just a "0" in it.

for example, row 25, has 0 in columns 12-34. So I need column B to equal the SUM of B35-46

THANKS!
finnstoneAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KoenChange and Transition ManagerCommented:
so, in cell B2, write the following array function:
{=SUM(OFFSET(B2,0,1,1,SMALL(IF(C2:xx2<>0,COLUMN(C2:xx2)-MIN(COLUMN(C2:xx2))+1),12)))}
(replace xx with last column of your data.

remember array function must be entered with CTRL+SHIFT+ENTER
it will sum up the first 12 non zero values starting from C2
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KoenChange and Transition ManagerCommented:
thank you for the points... Come to think of it, my formula may not be exactly what you want/ need:

if you want to sum the first 12 non zero columns, than formula above is the way to go.

if you want to sum 12 columns, starting from the first non zero value (and regardless of the value of those 12 columns, i.e. could be zero), than the formula is a lot simpler; type in B2:
=SUM(OFFSET(B2,0,INDEX(MATCH(TRUE,C2:xx2<>0,0),1),1,12))
(no array formula, replace xx with your last column)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.