• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to sum multiple columns

rossa

New Member
Hi all,
This question is more out of interest than necessity, but it's bugging me all the same.
I'm trying to sum multiple columns, which are random. Apologies, I can't upload an example.
In my sheet Columns D to O are named Jan to Dec (for months). Corresponding rows, 2 through 7 have numbers.
I have a dynamic named range called Months which can contain the column headers.
I'm trying to create a formula so that whenever this range is populated, the corresponding columns are summed. For example if the named range contains Jan, Feb & Jun; then the columns containing numbers for these months are summed.
I can get it to work with a helper column, but without the best option seems to be Index where more than one column is used.
I have tried the below formula, but it only returns the sum of the first column.
INDEX($D$2:$O$7,0,MATCH(Months,$D$1:$O$1,0))

Any help is appreciated.
 
A formula like this would work:
=SUMPRODUCT((COUNTIF(RangeOfInputs,D1:O1)>0)*(D2:O7))
 

Attachments

  • MultiColSum.xlsx
    8.9 KB · Views: 1
Back
Top