+ Reply to Thread
Page 2 of 3 FirstFirst 2
Results 201 to 400 of 413

date criteria to select range

  1. #201
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  2. #202
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  3. #203
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  4. #204
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  5. #205
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  6. #206
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  7. #207
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  8. #208
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  9. #209
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  10. #210
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  11. #211
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  12. #212
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  13. #213
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  14. #214
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  15. #215
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  16. #216
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  17. #217
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  18. #218
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  19. #219
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  20. #220
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  21. #221
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  22. #222
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  23. #223
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  24. #224
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  25. #225
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  26. #226
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  27. #227
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  28. #228
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  29. #229
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  30. #230
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  31. #231
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  32. #232
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  33. #233
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  34. #234
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  35. #235
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  36. #236
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  37. #237
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  38. #238
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  39. #239
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  40. #240
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  41. #241
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  42. #242
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  43. #243
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  44. #244
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  45. #245
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  46. #246
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  47. #247
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  48. #248
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  49. #249
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  50. #250
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  51. #251
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  52. #252
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  53. #253
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  54. #254
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  55. #255
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  56. #256
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  57. #257
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  58. #258
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  59. #259
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  60. #260
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  61. #261
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  62. #262
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  63. #263
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  64. #264
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  65. #265
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  66. #266
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  67. #267
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  68. #268
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  69. #269
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  70. #270
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  71. #271
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  72. #272
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  73. #273
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  74. #274
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  75. #275
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  76. #276
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  77. #277
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  78. #278
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  79. #279
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  80. #280
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  81. #281
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  82. #282
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  83. #283
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  84. #284
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  85. #285
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  86. #286
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  87. #287
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  88. #288
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  89. #289
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  90. #290
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  91. #291
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  92. #292
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  93. #293
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  94. #294
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  95. #295
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  96. #296
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  97. #297
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  98. #298
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  99. #299
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  100. #300
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  101. #301
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  102. #302
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  103. #303
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  104. #304
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  105. #305
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  106. #306
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  107. #307
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  108. #308
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  109. #309
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  110. #310
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  111. #311
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  112. #312
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  113. #313
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  114. #314
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  115. #315
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  116. #316
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  117. #317
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  118. #318
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  119. #319
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  120. #320
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  121. #321
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  122. #322
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  123. #323
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  124. #324
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  125. #325
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  126. #326
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  127. #327
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  128. #328
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  129. #329
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  130. #330
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  131. #331
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  132. #332
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  133. #333
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  134. #334
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  135. #335
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  136. #336
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  137. #337
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  138. #338
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  139. #339
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  140. #340
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  141. #341
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  142. #342
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  143. #343
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  144. #344
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  145. #345
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  146. #346
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  147. #347
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  148. #348
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  149. #349
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  150. #350
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  151. #351
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  152. #352
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  153. #353
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  154. #354
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  155. #355
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  156. #356
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  157. #357
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  158. #358
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  159. #359
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  160. #360
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  161. #361
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  162. #362
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  163. #363
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  164. #364
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  165. #365
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  166. #366
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  167. #367
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  168. #368
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  169. #369
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  170. #370
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  171. #371
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  172. #372
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  173. #373
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  174. #374
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  175. #375
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  176. #376
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  177. #377
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  178. #378
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  179. #379
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  180. #380
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




  181. #381
    Biff
    Guest

    Re: date criteria to select range

    Max, what do you see that I don't?

    I would think this should be sufficient:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),.................

    Biff

    "Max" <[email protected]> wrote in message
    news:[email protected]...
    > And if there's the possibility that the number of historic data days in
    > Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    > to just sum the available historicals up till and inclusive of "today"
    > (notwithstanding it's less than the specified 7 days), we could put
    > instead
    > in Sheet2's A2:
    >
    > =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    > eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    > MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))
    >
    > and copy down as before ..
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    >
    >
    >




  182. #382
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > Max, what do you see that I don't?
    > I would think this should be sufficient:
    > =IF(COUNT(2:2)<7,SUM(A2:AE2),.................


    Trouble is <g>, I had assumed that there could be previous month's metrics
    still residing within the data rows (to the right of the current date's
    col), either missed* out in the monthly purging exercise despite the refresh
    of the current month's dates in the header row
    *or yet to be purged because the data entry method followed is to
    progressively overwrite.

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  183. #383
    Max
    Guest

    Re: date criteria to select range

    Try instead :

    =IF(T25=0,0,IF(MATCH(TODAY(),1:1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY()
    ,1:1,0)-1,,-(MATCH(TODAY(),1:1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,
    -(MATCH(TODAY(),1:1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY(),1:1,0)
    -1,,-7)),(OFFSET(A25,,MATCH(TODAY(),1:1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Works well thanks Biff and Max.
    >
    > I have one other question relating to this... I am trying to
    > incorporate a sumproduct function into the formula and cannot quite get
    > it to behave how I would like.
    >
    >

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,
    >

    0)-1,,-7)))/T25))-1,,-(MATCH(TODAY(),$1:$1,0)-1))),SUMPRODUCT((OFFSET(A3,,MA
    TCH(TODAY(),$1:$1,
    > 0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1, 0)-1,,-7)))/T25)
    >
    >
    > Again, if you get a minute could you take a look at the attached
    > formula and poitn out the error in my ways.
    >
    > Thanks again.
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  184. #384
    Max
    Guest

    Re: date criteria to select range

    Try this instead
    (replaced: "1:1" with "$1:$1", to sync with your posted formula)

    =IF(T25=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A3,,MATCH(TODAY
    (),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A25,,MATCH(TODAY(),$1:$
    1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/T25,SUMPRODUCT((OFFSET(A3,,MATCH(TODA
    Y(),$1:$1,0)-1,,-7)),(OFFSET(A25,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/T25))

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  185. #385
    Max
    Guest

    Re: date criteria to select range

    Believe essentially that you have dates running along from B1 across (B1,
    C1, D1, ...) which do not necessarily start from the 1st of the month in B1

    Try this revision:

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    H(TODAY(),$1:$1,0)-1,,-7)))/S17))

    The changes made are to the 2nd IF where:

    IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)

    replaces the previous :

    IF(MATCH(TODAY(),$1:$1,0)-1<7

    and to the width params of OFFSET within the 1st SUMPRODUCT, where:

    -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    +1

    replaces the previous:

    -(MATCH(TODAY(),$1:$1,0)-1

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Alternatively.... Is it possible to add criteria to the equation below.
    >
    > The reason I ask is I am trying to stop the equation below (which works
    > perfectly thanks Max) from going past the 1st of the month should i be
    > trying to add a weekly summary from the 6th day of the month back to
    > the 1st.
    >
    > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    > (--------------)
    >
    >

    "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >
    > All help greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  186. #386
    Max
    Guest

    Re: date criteria to select range

    > .......... Is this possible?

    Could you send over a copy of your file?
    High-time for me to sync-in exactly what's happening over there <g>
    Email to: demechanik <at> yahoo <dot> com
    Post a response here to alert me when you send ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  187. #387
    Biff
    Guest

    Re: date criteria to select range

    ugh!

    <g>

    Biff

    "Max" <[email protected]> wrote in message
    news:%[email protected]...
    > Believe essentially that you have dates running along from B1 across (B1,
    > C1, D1, ...) which do not necessarily start from the 1st of the month in
    > B1
    >
    > Try this revision:
    >
    > =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    > ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    > ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-(MATC
    > H(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)+1))))
    > /S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATC
    > H(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    > The changes made are to the 2nd IF where:
    >
    > IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6)
    >
    > replaces the previous :
    >
    > IF(MATCH(TODAY(),$1:$1,0)-1<7
    >
    > and to the width params of OFFSET within the 1st SUMPRODUCT, where:
    >
    > -(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(TODAY()),1),$1:$1,0)
    > +1
    >
    > replaces the previous:
    >
    > -(MATCH(TODAY(),$1:$1,0)-1
    >
    > --
    > Rgds
    > Max
    > xl 97
    > ---
    > Singapore, GMT+8
    > xdemechanik
    > http://savefile.com/projects/236895
    > --
    > "Kstalker" <[email protected]> wrote
    > in
    > message news:[email protected]...
    >>
    >> Alternatively.... Is it possible to add criteria to the equation below.
    >>
    >> The reason I ask is I am trying to stop the equation below (which works
    >> perfectly thanks Max) from going past the 1st of the month should i be
    >> trying to add a weekly summary from the 6th day of the month back to
    >> the 1st.
    >>
    >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .......etc
    >> (--------------)
    >>
    >>

    > "=IF(S17=0,0,IF(MATCH(TODAY(),$1:$1,0)-1<7,SUMPRODUCT((OFFSET(A9,,MATCH(TODA
    > Y(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))),(OFFSET(A17,,MATCH(TODAY(),$1:
    > $1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TOD
    > AY(),$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))"
    >>
    >> All help greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:

    > http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  188. #388
    Max
    Guest

    Re: date criteria to select range

    "Kstalker" wrote:
    > Mail enroute.
    > Unsure if it is possible.


    Thanks for alert. I can only access my yahoo acc in about 10 hours time, so
    hang in there awhile. I will post back the findings either way <g>.

    In the interim ... FWIW I had actually prepared a response (below) to your
    earlier post yesterday on the new issue raised before your 2nd post came
    through. In case you would like to see it through:

    > The formula below is being used to sumproduct any data where the
    > criteria "stop" is met. However I can only sum this data (sumif) which
    > is not accurate as if more than one coumn contains the criteria it is
    > summed . Is there a way that I can set the criteria as in using the
    > sumif function but still produce the sumproduct results??
    >

    =IF(S30=0,0,SUMPRODUCT(SUMIF($A$2:$Q$2,"stop",A19:Q19),SUMIF($A$2:$Q$2,"stop
    ",A30:Q30)/S30))

    Think I might have lost my way somewhere here ..

    As it stands, your posted formula is equivalent to:

    =IF(S30=0,0,SUMIF($A$2:$Q$2,"stop",A19:Q19)*SUMIF($A$2:$Q$2,"stop",A30:Q30)/
    S30)

    (i.e. with the "*" replacing the SUMPRODUCT( ..))

    So, supposing you have:

    In A2:C2: stop stop stop
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    (All other cells within the posted formula are assumed blank)

    Your posted formula will return: 4500 (nothing wrong here), viz.:

    SUMIF($A$2:$Q$2,"stop",A19:Q19) returns: 30
    SUMIF($A$2:$Q$2,"stop",A30:Q30)/S30 returns: 150
    and then SUMPRODUCT(30,150) will return: 30 x 150 = 4500

    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    And if we clear say, cell C2, so that it becomes

    In A2:C2: stop stop <blank>
    In A19:C19: 10 10 10
    In A30:C30: 100 100 100
    In S30: 2

    Your posted formula will return: 2000 (again, nothing wrong here)
    What is your expected result ?
    If it's another value, pl explain how the expected result is computed

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  189. #389
    Max
    Guest

    Re: date criteria to select range

    "Biff" wrote
    > ugh!
    > <g>


    Thanks ! <g>
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    ---



  190. #390
    Max
    Guest

    Re: date criteria to select range

    Kristan,

    Ok, I've had a few really close looks and re-tested it
    several times, but I couldn't find anything wrong with
    the latest formula which was suggested. The formula
    doesn't pick up what's to the left of the 1st day of
    the month.

    Please refer to the attached file*, where I've
    simulated the test in the sheet: Begining month

    In K14 is the same formula as in K11
    but with "TODAY()" replaced by: "DATE(2005,8,4)" to
    simulate as if "today" is 4th Aug 2005. You'll see
    that the correct result is returned in K14 (same
    answer as your K9).

    *File: Kristan2a_Example.xls
    http://savefile.com/files/8213621

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  191. #391
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    Glad it finally worked out ok for you ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  192. #392
    Max
    Guest

    Re: date criteria to select range

    > ... to search on yesterdays date instead?

    Think we just need to do an Edit > Replace on the
    cell with the posted working formula

    Find what: TODAY()
    Replace with: TODAY()-1

    which yields:

    =IF(S17=0,0,IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),SUMPRODUCT((OFFSET(A
    9,,MATCH(TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TO
    DAY()-1),MONTH(TODAY()-1),1),$1:$1,0 )+1))),(OFFSET(A17,,MATCH(
    TODAY()-1,$1:$1,0)-1,,-(MATCH(TODAY()-1,$1:$1,0)-MATCH(DATE(YEAR(TODAY()-1),
    MONTH(TODAY()-1),1),$1:$1,0 )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY()
    -1,$1:$1,0)-1,,-7)),(OFFSET(A17,,MATCH(TODAY()-1,$1:$1,0)-1,,-7)))/S17))

    (Above lightly tested in order <g>)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > No problem with all the attached solutions to this thread but have an
    > enhancement that needs to be made and was wondering how to acheive
    > this.
    >
    > Instead of running from todays date I need to run from yesterdays date.
    > If anybody has the patience could you advise on how i reconfigure the
    > today component of:
    >
    >

    =IF(S17=0,0,IF(AND(DAY(TODAY())>=1,DAY(TODAY())<=6),SUMPRODUCT((OFFSET(A9,,M
    ATCH(TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),M
    ONTH(TODAY()),1),$1:$1,0)+1))),(OFFSET(A17,,MATCH(
    >

    TODAY(),$1:$1,0)-1,,-(MATCH(TODAY(),$1:$1,0)-MATCH(DATE(YEAR(TODAY()),MONTH(
    TODAY()),1),$1:$1,0
    > )+1))))/S17,SUMPRODUCT((OFFSET(A9,,MATCH(TODAY(),$1:$1,0)-1,,-7)),(OFFSET(

    A17,,MATCH(TODAY(),$1:$1,0)-1,,-7)))/S17))
    >
    >
    > to search on yesterdays date instead?
    >
    > I am certain it is simple but cannot crack it.
    >
    > Thanks in advance
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  193. #393
    Max
    Guest

    Re: date criteria to select range

    Try instead:

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),$338:$338,0)+1))),"Formula_OR_Value_if_FALSE")

    Replaced : " 19:19 " in your posted formula
    with: " $338:$338 "

    Believe the above is the main error part
    ... how on earth did the " 19:19 " creep into the picture ? <g>

    I've also added a phrase: "Formula_OR_Value_if_FALSE"
    since your posted formula was w/o this value
    (just change the phrase to whatever
    you want returned as the value if FALSE.)

    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max.
    >
    > I though it was as simple as that but I keep coming up with a 'false'
    > result using the formula below.....
    >
    >

    =IF(AND(DAY(TODAY()-1)>=1,DAY(TODAY()-1)<=6),AVERAGE(OFFSET(A536,,MATCH(TODA
    Y()-1,$338:$338,0)-1,,-(MATCH(TODAY()-1,$338:$338,0)-MATCH(DATE(YEAR(TODAY()
    -1),MONTH(TODAY()-1),1),19:19,0)+1))))
    >
    > Absoultely stumped.....
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  194. #394
    Max
    Guest

    Re: date criteria to select range

    One play ..

    Assuming in Sheet1, you have real dates in B1:AF1
    from say: 1-Aug-2005 to 31-Aug-2005
    with the numbers (your metrics) below in B2:AF2, B3:AF3 etc

    In Sheet2 (say), we could put in A2:
    =SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7))
    and copy A2 down to return the desired results from the corresponding rows
    in Sheet1
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:

    http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  195. #395
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    So, what exactly do want to sum? (where is it?)

    What if today is August 6? There aren't 7 days worth of data to sum!

    One way.....

    Assume row 1, A1:AE1, are the date headers in the format 8/1/2005

    To sum the last 7 entries in row 2 from todays date (inclusive):

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello
    >
    > I have a conundrum which is proving very difficult.
    >
    > I have a month set of data which has each day of the month as a header
    > and then a series of metrics under each day. What I need to do is sum 7
    > days worth of historic data from and including today.
    >
    > in laymans
    >
    > " if the column header = today then sum inc today the previous 7 days
    > from this row. "
    >
    > As you can see i am at a loss. Have tried count, sumproduct etc but
    > cannot pull it together.
    >
    > Any help as always greatly appreciated
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  196. #396
    Biff
    Guest

    Re: date criteria to select range

    Ooops!

    One of the cell references is wrong. Should be:

    =IF(COUNT(2:2)<7,"Insufficient
    Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Biff" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi!
    >
    > So, what exactly do want to sum? (where is it?)
    >
    > What if today is August 6? There aren't 7 days worth of data to sum!
    >
    > One way.....
    >
    > Assume row 1, A1:AE1, are the date headers in the format 8/1/2005
    >
    > To sum the last 7 entries in row 2 from todays date (inclusive):
    >
    > =IF(COUNT(2:2)<7,"Insufficient
    > Data",SUM(OFFSET(A2,,MATCH(TODAY(),A1:H1,0)-1,,-7)))
    >
    > Biff
    >
    > "Kstalker" <[email protected]> wrote
    > in message news:[email protected]...
    >>
    >> Hello
    >>
    >> I have a conundrum which is proving very difficult.
    >>
    >> I have a month set of data which has each day of the month as a header
    >> and then a series of metrics under each day. What I need to do is sum 7
    >> days worth of historic data from and including today.
    >>
    >> in laymans
    >>
    >> " if the column header = today then sum inc today the previous 7 days
    >> from this row. "
    >>
    >> As you can see i am at a loss. Have tried count, sumproduct etc but
    >> cannot pull it together.
    >>
    >> Any help as always greatly appreciated
    >>
    >>
    >> --
    >> Kstalker
    >> ------------------------------------------------------------------------
    >> Kstalker's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24699
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=395995
    >>

    >
    >




  197. #397
    Max
    Guest

    Re: date criteria to select range

    And if there's the possibility that the number of historic data days in
    Sheet1's B1:AF1 is < 7 days from "today", and you want for such situations
    to just sum the available historicals up till and inclusive of "today"
    (notwithstanding it's less than the specified 7 days), we could put instead
    in Sheet2's A2:

    =IF(MATCH(TODAY(),Sheet1!$1:$1,0)-1<7,SUM(OFFSET(Sheet1!A2,,MATCH(TODAY(),Sh
    eet1!$1:$1,0)-1,,-(MATCH(TODAY(),Sheet1!$1:$1,0)-1))),SUM(OFFSET(Sheet1!A2,,
    MATCH(TODAY(),Sheet1!$1:$1,0)-1,,-7)))

    and copy down as before ..
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --




  198. #398
    Max
    Guest

    Re: date criteria to select range

    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.


    That's what I thought you might want <g>.
    One way .. see my follow up response in the other branch
    (think you just missed it !)
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --



  199. #399
    Biff
    Guest

    Re: date criteria to select range

    Hi!

    Try this:

    =IF(COUNT(2:2)<7,SUM(A2:AE2),SUM(OFFSET(A2,,MATCH(TODAY(),A1:AE1,0)-1,,-7)))

    Biff

    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Cheers Max / Biff.
    >
    > Biff as you pointed out there is the possibility of less than a weeks
    > worth of data if it is at the begining of the month.
    >
    > If this occours i need to sum the week to dat figures even though there
    > are less than 7 entries.
    >
    > If you have a minute, how can I acheive this?
    >
    > Thanks
    >
    > Kristan
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile:
    > http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=395995
    >




  200. #400
    Max
    Guest

    Re: date criteria to select range

    You're welcome, Kristan !
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "Kstalker" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Excellent.
    >
    > Thanks for that Max.
    >
    > Regards
    >
    > Kristan




+ Reply to Thread
Page 2 of 3 FirstFirst 2

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