+ Reply to Thread
Results 1 to 4 of 4

How to sum columns based on two column headers as criteria

  1. #1
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    How to sum columns based on two column headers as criteria

    Hi,

    I have here a table in which I need to get the total amount of "No" and "Sales" of the parameter I put on cell A23.

    I'm my current formula in cell B23 and C23, I'm only getting the value of the first row. I couldn't quite figure out the formula that would sum up the whole column.

    Also, I made a data list on cell A23, in which if I change it, the formula in cell B23 and C23 would automatically populate.

    Hope someone could help me out! Thank you!
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: How to sum columns based on two column headers as criteria

    hey there. so you don't need SUMIF. SUMIF requires the number of rows and columns or range and sum_range to be equal. it checks if B1:P1 has Rochedale. and sum B3. it then ends there because you didn't state other rows to check.

    so simply:
    =SUM(INDEX($B$3:$P$14,,MATCH(B22,$B$2:$P$2,0)))
    copy over

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Contributor
    Join Date
    10-30-2003
    Location
    Singapore
    MS-Off Ver
    Excel 2019
    Posts
    197

    Re: How to sum columns based on two column headers as criteria

    Perhaps……….

    In B23, copied right to C23

    =OFFSET($A15,0,MATCH($A23,$B$1:$P$1,0)+MATCH(B$22,$B$2:$D$2,0)-1)

    or,

    =SUM(INDEX($B$3:$P$14,,MATCH($A23,$B$1:$P$1,0)+MATCH(B$22,$B$2:$D$2,0)-1))

    Regards
    Bosco

  4. #4
    Forum Contributor
    Join Date
    09-19-2017
    Location
    Taguig City, Philippines
    MS-Off Ver
    Microsoft Excel 2016
    Posts
    120

    Re: How to sum columns based on two column headers as criteria

    Thank you both for the help!

    I think the last formula from Bosco works perfectly! it captures all the figures that I need!

    Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 12-13-2016, 03:06 PM
  2. Sum across columns based on column headers or count of columns
    By RandiLee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2016, 09:59 AM
  3. Replies: 2
    Last Post: 12-09-2015, 05:43 AM
  4. copy and paste columns based on column headers
    By patwary786 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-24-2015, 11:43 PM
  5. Replies: 0
    Last Post: 06-04-2015, 07:57 AM
  6. Count Number of occurences Across Columns based on Similar Column Headers
    By vidyuthrajesh in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-27-2013, 06:42 PM
  7. Summary - Copy the columns based on column headers
    By rafiomeon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2012, 10:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1