+ Reply to Thread
Results 1 to 15 of 15

Help: Formula to find row header, then sum that column

Hybrid View

  1. #1
    Registered User
    Join Date
    07-27-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    8

    Red face Help: Formula to find row header, then sum that column

    Hello! This is my first time posting. I'm working on a spreadsheet and here is my dilemma:
    I would like to identify the row header, then sum the values in the column under that header.

    Sounds simple enough, but I cannot get it. I have tried various combinations of HLOOKUP, SUM, SUMIF, and INDEX/MATCH
    Any help would be appreciated!

  2. #2
    Registered User
    Join Date
    07-27-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    8

    Re: Help: Formula to find row header, then sum that column

    For example, I would like to identify in the top row, which column has header 'Ad_impressions', then sum the values in that row to give me the sum
    I understand how to use hlookup, but instead of returning the value in the next row, I want to sum the values in that column under the header

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help: Formula to find row header, then sum that column

    Try something like this...

    Data Range
    A
    B
    C
    D
    1
    Header1
    Header2
    Header3
    2
    North
    5
    74
    26
    3
    East
    8
    52
    23
    4
    South
    96
    61
    42
    5
    West
    23
    95
    77
    6
    7
    8
    9
    10
    Header2
    282


    This formula entered in B10:

    =SUM(INDEX(B2:D5,0,MATCH(A10,B1:D1,0)))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Help: Formula to find row header, then sum that column

    Try this:

    MatchCol.xlsx

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help: Formula to find row header, then sum that column

    Quote Originally Posted by cyiangou View Post
    Try this:

    Sorry for off-topic interjection:

    Although there is no official rule regarding this behavior, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand, and we look forward to seeing you post your formulas/macros in your posts for the searching benefit of all.

    Thanks again for all your hard work here!

  6. #6
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Help: Formula to find row header, then sum that column

    Hi Tony

    Agree with you entirely. But sometimes the question is extremely clear, and when the answer (especially a small one), is a direct fulfillment of the OP, then further explanation seems redundant. For example:

    Q: I would like to identify the row header, then sum the values in the column under that header.
    A: Try this formula: It identifies the row header, then sums the values in the column under that header.

    If I had devised some unintuitively weird way of solving it, I would have provided further explanation.

    But agreed, such terse replies don't form a natural 'bullet point' within the thread. Even 'This should do what you need' would have been better than 'Try this' as it identifies itself as an answer.

    Sorry, you made me think.

  7. #7
    Registered User
    Join Date
    07-27-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    8

    Re: Help: Formula to find row header, then sum that column

    Thanks Tony Valko, but I am getting a value error. My data in some columns are text, and in other its numerical. The column I would like to sum is numerical of course, but I believe mixing text data in this table means that this formula will not work.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help: Formula to find row header, then sum that column

    The SUM function will ignore text entries.

    Can you post a SMALL sample file and show us what result you expect?

    A SMALL file will have about 20 rows worth of data.

  9. #9
    Registered User
    Join Date
    07-27-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    8

    Re: Help: Formula to find row header, then sum that column

    Ad impressions CTR CPC Network Name
    100 3 2 GDN Client 1
    75 2 4 SEM Client 2
    100 3 3 SEM Client 3
    80 5 4 GDN Client 4
    30 2 1 SEM Client 5

    I would like the formula to find the column labeled Ad_impressions, then sum the values in this row.
    I need it to be able to seek out the column header itself because the data I import will not always have the columns in the same order. For ex. it may be ad_impressions/ctr/cpc/network/name the first time, and another time it may be imported as cpc/name/network/ad_impressions/ctr... so no matter what order the columns are in, it needs to be able to seek out ad_impressions and then sum the total number of impressions in that column

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help: Formula to find row header, then sum that column

    Data Range
    A
    B
    C
    D
    E
    1
    Ad impressions
    CTR
    CPC
    Network
    Name
    2
    100
    3
    2
    GDN
    Client 1
    3
    75
    2
    4
    SEM
    Client 2
    4
    100
    3
    3
    SEM
    Client 3
    5
    80
    5
    4
    GDN
    Client 4
    6
    30
    2
    1
    SEM
    Client 5
    7
    8
    9
    Match Header
    Sum
    10
    Ad impressions
    385
    11


    This formula entered in B10:

    =SUM(INDEX(A2:E6,0,MATCH(A10,A1:E1,0)))

    Here's a small sample file to demonstrate this.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-27-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    8

    Re: Help: Formula to find row header, then sum that column

    Nevermind, I got it! Thank you very much for your help!

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help: Formula to find row header, then sum that column

    Good deal. Thanks for the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

  13. #13
    Registered User
    Join Date
    07-27-2015
    Location
    Atlanta, GA
    MS-Off Ver
    2010
    Posts
    8

    Re: Help: Formula to find row header, then sum that column

    great thanks! this is exactly what i am looking for. however, i am getting the #Value! error, but possibly related to syntax since i am posting the formula on a separate sheet from the data table

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Help: Formula to find row header, then sum that column

    Post the EXACT formula that you are trying to use.

  15. #15
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help: Formula to find row header, then sum that column

    Perhaps if you upload an example workbook? (Go Advanced>Manage Attachments) Sounds like your data might be all text and no numbers (even if they look like numbers)
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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. Sort Select Range: Either Find Column Header or Last Column:Last Row
    By mbryson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-02-2014, 08:03 AM
  2. Replies: 2
    Last Post: 03-03-2014, 10:56 AM
  3. [SOLVED] Find specific value in table and return header row and header column value
    By nelwan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2013, 01:35 AM
  4. Replies: 2
    Last Post: 04-26-2013, 01:16 PM
  5. [SOLVED] Formula to find header and insert in new column
    By dbracken1 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-03-2012, 03:50 AM
  6. [SOLVED] Formula to find first negative number in row and return column header
    By spoonedmango in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-09-2012, 02:08 PM
  7. Search for column header and find all values and their row numbers in that column
    By woody83 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-14-2012, 03:11 PM

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