• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 32
  • Last Modified:

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!
0
finnstone
Asked:
finnstone
  • 2
1 Solution
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now