+ Reply to Thread
Results 1 to 7 of 7

SUMIF with changing column headers.

  1. #1
    Registered User
    Join Date
    03-25-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    21

    Question SUMIF with changing column headers.

    Hi all,

    Basically I am looking for a cross between a [SUMIF] and a [VLOOKUP/MATCH]. I have one table of data: TABLE A; it contains values from a month against place format. I have attached a simplified version for you to take a look at.

    What I need is to sum all the relevant values into TABLE B.

    Although this is simple enough using [SUMIF], my problem arises because the column titles in TABLE A are not always in the same place, they change position everytime the report is run.

    Can someone please help??

    DATA-EXAMPLE.xlsx

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: SUMIF with changing column headers.

    Try something like:
    =SUM(($A3:$A17=$I2)*IF($B$2:$G$2=I$3,$B$3:$G$17))
    as an array formula in I4 (confirm with ctrl + shift + enteR) and copy down/across as neccessary.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: SUMIF with changing column headers.

    in i4 filled across
    =SUMIF($A$3:$A$17,$I2,INDEX($B$3:$G$17,0,MATCH(I3,$B$2:$G$2,0)))
    copy to i10 and i16
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: SUMIF with changing column headers.

    I used sumproduct for this solution:
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Registered User
    Join Date
    03-25-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    21

    Question Re: SUMIF with changing column headers.

    @martinwilson

    Hi Martin,

    That worked perfectly for me thanks, but now I have to ask for something a little more complicated. So I also want to return the values depending on the weeks of the month too, I have updated the spreadsheet with the new requirements. So if I change the week on TABLE B then it will return the appropriate values.

    Thanks for your help so far.

    Regards,

    JM

    DATA-EXAMPLE PART(2).xlsx

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: SUMIF with changing column headers.

    id go for the sum product version in j4
    =SUMPRODUCT(($B$3:$B$17=$K2)*($A$3:$A$17=$J2)*($C$2:$H$2=J3)*($C$3:$H$17))

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: SUMIF with changing column headers.

    I have produced a workbook using SUMPRODUCT to include the week requirement.
    Attached Files Attached Files

+ 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] Column Lettering Changing to Column Headers
    By tullybcfc in forum Excel General
    Replies: 6
    Last Post: 11-19-2013, 06:55 AM
  2. Sumif With Multiple Column Headers
    By Log0920 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-29-2013, 10:30 AM
  3. Copying and changing column headers
    By pazzuzu in forum Excel General
    Replies: 2
    Last Post: 02-17-2010, 09:53 AM
  4. [SOLVED] Changing the Column Headers back to letters from #s
    By coach_fletcher in forum Excel General
    Replies: 2
    Last Post: 07-07-2006, 10:25 AM
  5. CHANGING THE COLUMN HEADERS FROM ABC.. TO 123..
    By ANNE V in forum Excel General
    Replies: 4
    Last Post: 09-16-2005, 04:05 AM

Tags for this Thread

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