+ Reply to Thread
Results 1 to 8 of 8

Sum multiple columns based on header

  1. #1
    Registered User
    Join Date
    04-06-2011
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    6

    Sum multiple columns based on header

    I have a sheet with information like the following
    2013-08-14_12h39_56.png

    And wish to create a summary sheet in like so

    2013-08-14_12h41_10.png




    And I need to write a formula that will lookup values in row 3 on sheet 1 based on the name in column A of sheet 2 and give me a sum of the values beneath it for every occurrence of it. In this example bob appears twice so we need to find the total for both columns.

    Sheet1 will be for one month only and a new sheet will be incorporated for any new month.

    I have got lost in sumifs and sumif's and now my brain has exploded so any help appreciated.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sum multiple columns based on header

    Try something like:

    =SUMPRODUCT((TEXT(Sheet2!$A$5:$A$11,"MMMM")=B$1)*(Sheet2!$C$3:$G$3=$A2),Sheet2!$C$5:$G$11)

    adjust sheetnames and ranges to suit.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Sum multiple columns based on header

    =SUMPRODUCT((Sheet1!C3:G3="Bob")*(Sheet1$C$4:$G$100))
    for instance
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Sum multiple columns based on header

    Hi towndrunk,

    See my example on how to change the way you save your data and then how to create a Pivot Table to get the answer you are looking for.
    Time to start looking at Pivot Tables?
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    04-06-2011
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sum multiple columns based on header

    Thanks for the quick response..

    Response to JosephP

    This works perfectly for my example given but when transposing it to the real world sheet I have a problem - some of values in the range Sheet1$C$4:$G$100 have descriptive text values in them (such as holiday or bank holiday) which break the sumproduct as they return a #value! as the formula steps through.

    other than a reworking of the way we record holidays, any thoughts on a way round this?

  6. #6
    Registered User
    Join Date
    04-06-2011
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sum multiple columns based on header

    Response to MarvinP

    Piviot Tables would be lovely. Unfortunately I will not be able to change the practice of how the data is currently captured so unless there is an easy way of converting the format I have into the one needed for a pivot table then I will have to try and figure out using just a formula.

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Sum multiple columns based on header

    perhaps
    =SUMPRODUCT((Sheet1!C3:G3="Bob")*ISNUMBER(Sheet1$C$4:$G$100),Sheet1$C$4:$G$100)

  8. #8
    Registered User
    Join Date
    04-06-2011
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sum multiple columns based on header

    This looks perfect. Now I just need to work out a way of the formula picking up the filename of the sheet it is referencing by a variable set in another cell and im done :D

+ 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. [SOLVED] Sort multiple columns based on column header
    By Langer101 in forum Excel Programming / VBA / Macros
    Replies: 39
    Last Post: 01-09-2013, 09:55 AM
  2. Replies: 2
    Last Post: 10-13-2012, 03:30 AM
  3. Replies: 0
    Last Post: 05-12-2011, 04:24 PM
  4. Sum columns based on header cell
    By CJ-22 in forum Excel General
    Replies: 4
    Last Post: 11-14-2010, 12:41 AM
  5. Delete Columns Based on Header
    By MSmithson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2010, 03:19 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