+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    01-19-2005
    Location
    Kent UK
    Posts
    40

    SumIf but using a range as a criterion.

    I have a large spreadsheet, to which I add 4 weeks worth of data, from a database printout, (cut n paste) to the bottom, this could be any number of rows.

    However there is a column with week numbers in for each row.

    I can happily use =SUMIF('FORM R60'!$H$1:$H$1248,$A1,'FORM R60'!$AH$1:$AH$1248)

    This gives me the info I need on a TOTALS sheet, across various columns and rows, where the formula sits, adjusted for whichever column of data I require totals. This info is then read by another spreadsheet.

    However, rather than manually change the formula (to suit a range) to add certain numbers of weeks, as I do now, I would like to include in the formula a condition say where the week numbers are >5 and <10, preferably if the condition could refer to cells.

    Say for instance I have Starting Week # and I can input 5 in the cell and then adjacent I can have Ending Week # and I can input 10 in the cell. The following month I can have it start from 11 to 16, and so on.

    So the SumIf formula would need to refer to 'FORM R60'!$F$1:$F$5000 > [the cell on the 'TOTALS' sheet which has the commencing week #] to < [the cell on the 'TOTALS' sheet which has the ending week #]. Column F being the one which holds the week number. I anticipate that a year of data will go to 5000 rows.

    This would then change every formula in the 'TOTALS' sheet to suit the week number range I enter in the two cells.

    I use Excel 2003.

    Can it be done?

    Thanks
    Last edited by philiphales; 06-19-2009 at 07:34 AM.

  2. #2
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,145

    Re: SumIf but using a range as a criterion.

    Maybe:

    Code:
    =Sumproduct(--('FORM R60'!$H$1:$H$5000=$A1),--('FORM R60'!$F$1:$F$5000>'TOTALS'!$X$1),--('FORM R60'!$F$1:$F$5000<'TOTALS'!$Y$1),'FORM R60'!$AH$1:$AH$5000)
    Where X1 and Y1 on TOTALS sheet hold the start/end values... change as necessary.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    01-19-2005
    Location
    Kent UK
    Posts
    40

    Re: SumIf but using a range as a criterion.

    This appears to suit my needs, but is returning a zero!

    On the TOTALS there are references to R33 sheet (this is a forcasting tool) and looks forward from week 10 to week 53 (currently).
    The R60 is as Invoiced for for the current Period 03 (we have 13 per year) I have a total of weeks 01 to 09.

    On another sheet I take the 3 periods cost (displayed by period) and add the R33 cost to give me the total cost for each component. Rail; Sleepers; Ballast & Haulage.

    Period 04 will reflect the R33 from week 14 to week 53 and the R60s will be week 01 to 13.

    Each successive period reducing the R33 by 4 and increasing the R60 by 4.

    I have included comments adjacent to each CELL.

    The R33 changes as the planners review each job.

    I hope the upload works!!!

    Your assistance is greatly appreciated.

    Regards Philip
    Attached Files Attached Files
    Last edited by philiphales; 06-19-2009 at 05:42 AM. Reason: ask if upload worked as I can not see it

  4. #4
    Valued Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    Excel 2003
    Posts
    458

    Re: SumIf but using a range as a criterion.

    Try this as i just add = sign for start & end week .....

    =SUMPRODUCT(--('FORM R60'!$H$2:$H$5000=$A207),--('FORM R60'!$F$2:$F$5000>=TOTALS!$M$197),--('FORM R60'!$F$2:$F$5000<=TOTALS!$N$197),'FORM R60'!$AV$2:$AV$5000)
    Last edited by mubashir aziz; 06-19-2009 at 06:58 AM.
    If this post helps, Please don't 4get to add to My reputation by clicking BluScale Icon in the Top Right Corner of Blue Bar of my Post.

  5. #5
    Registered User
    Join Date
    01-19-2005
    Location
    Kent UK
    Posts
    40

    Re: SumIf but using a range as a criterion.

    Mubashir

    Thanks for that and thanks to to NBVC

    Regards Philip

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.2.0