+ Reply to Thread
Results 1 to 6 of 6

Sum if - More than one column, mivng range, fix starting point

  1. #1
    Registered User
    Join Date
    11-13-2012
    Location
    amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    3

    Sum if - More than one column, mivng range, fix starting point

    Hi,

    I have the following Database :

    Columns :
    A : Store Number
    B : Jan
    C: Feb
    D : Mar
    Etc..

    Rows :
    A1 : Store 1
    A2 : Store 2
    A3 : Store 1
    A4 : Store 1
    A5 : Store 2
    B1 to DXX : Data
    Etc.

    I would like to automatize the report in a way that when I update the month (in cell X10 for instance), the sumif formula will update its range automatically.

    Example (to retrieve store 1 data) :
    * If cell X10 is set on Jan, the formula should be : sumif(A:A,"store 1",B:B)
    * If cell X10 is set on Feb, the formula should be : sumif(A:A,"store 1",B:C)
    * If cell X10 is set on March, the formula should be : sumif(A:A,"store 1",B:D)

    How can I automatize this?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,494

    Re: Sum if - More than one column, mivng range, fix starting point

    This is one way to adjust the column as you have described:

    =SUMIF(A:A,"store 1",INDIRECT(CHOOSE(MATCH(X10,{"Jan","Feb","Mar"},0),"B","C","D") & ":" & CHOOSE(MATCH(X10,{"Jan","Feb","Mar"},0),"B","C","D")))

    However, I'm not sure you can get SUMIF to sum more than one column.

    Anyway, it's a technique to play with.

    Regards, TMS

    Edit: I started with:

    =SUMIF(A:A,"store 1",INDIRECT("B:" & CHOOSE(MATCH(X10,{"Jan","Feb","Mar"},0),"B","C","D")))

    but that always summed column B
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-19-2012
    Location
    York
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    59

    Re: Sum if - More than one column, mivng range, fix starting point

    Hi

    Would using a pivot table not prove more useful, and far quicker. I use a lot of sales data for regions / stores etc by week and month and create preset pivot templates.
    if you have the data file as above, and then a pivot table, which references the full database, when you enter new data in, refresh the PT and its all ready to go.
    You can use a the report filter tab at the top to select stores, or months,
    Adi

  4. #4
    Registered User
    Join Date
    11-13-2012
    Location
    amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Sum if - More than one column, mivng range, fix starting point

    Hi,

    Thanks both for you reply.

    I cant use pivot table is this file, that would make it to big in size. The database is a retrieve from hyperion (Actual, Budget, Last year, local currency, EUR), I have some mapping tables in between etc. Wont go too much in to details but the pivot table is not a good option, I need formulas.

    Indeed the sumif does not work......... is there any other formula that could be used here ? Not sure if sumproduct could work...?

    Thanks in advance for your help

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,494

    Re: Sum if - More than one column, mivng range, fix starting point

    You could add a helper column and use the technique described above to adjust the columns included in a simple SUM for each row.

    You could then use your SUMIF to produce subtotals by store using the helper column.

    Regards, TMS

  6. #6
    Registered User
    Join Date
    11-13-2012
    Location
    amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Sum if - More than one column, mivng range, fix starting point

    Hi TMS,
    Thanks for your answer.

    Not sure what you mean by a helper column but i don't want to pollute the report with extra column that I would need to update manually every month if a formula can do the job.

    English is not my primary language so maybe I havent been clear enough, I have included a simple example of I would like to achieve.
    I don't think this should be to complicated?

    example.xlsx
    Last edited by Skoum; 11-13-2012 at 10:19 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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