+ Reply to Thread
Results 1 to 5 of 5

Datevalue

  1. #1
    Registered User
    Join Date
    02-27-2005
    Posts
    3

    Datevalue

    I want to replace "1/1/05" and "3/31/05" in the below formula with a
    Date Function so that the formula will automatically update for the
    current year, ie, 1/1/05, 1/1/06, 1/1/07, etc.


    {=SUM(SUMIF($A$22:$A$200,{">=1/1/05","<=3/31/05","<>"},B22:B*200)*{1,1,-1})}


    Thanks

  2. #2
    Forum Contributor
    Join Date
    01-11-2004
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    388
    Hi!

    You can generate a string with the year appended using

    ="1/1/"& RIGHT(YEAR(TODAY()),2)

    which then reads 1/1/05. (well, it does this year)

    Alf

  3. #3
    Registered User
    Join Date
    02-27-2005
    Posts
    3
    Dear Alf,

    When I edited the formula as follows, the formula result changed from when I had 1/1/05 and 3/31/05 enterd. The serial numbers for the dates have somehow changed. I could not enter the parenthesis as shown, "1/1/" and "3/31/", without getting an error. Have I done this correctly?

    Thanks

    {=SUM(SUMIF($A$22:$A$200,{">=1/1/& RIGHT(YEAR(TODAY()),2)","<=3/31/& RIGHT(YEAR(TODAY()),2)","<>"},B22:B200)*{1,1,-1})}


    Your Reply:
    ="1/1/"& RIGHT(YEAR(TODAY()),2)

    Original:
    {=SUM(SUMIF($A$22:$A$200,{">=1/1/05","<=3/31/05","<>"},B22:B*200)*{1,1,-1})}

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Wouldn't the following formula do?

    =SUMPRODUCT(--($A$22:$A$200>=DATE(YEAR(TODAY()),1,1)),--($A$22:$A$200<=DATE(YEAR(TODAY()),3,31)),$B$22:$B$200)

    Quote Originally Posted by paschalleddie1
    I want to replace "1/1/05" and "3/31/05" in the below formula with a
    Date Function so that the formula will automatically update for the
    current year, ie, 1/1/05, 1/1/06, 1/1/07, etc.


    {=SUM(SUMIF($A$22:$A$200,{">=1/1/05","<=3/31/05","<>"},B22:B*200)*{1,1,-1})}


    Thanks

  5. #5
    Registered User
    Join Date
    02-27-2005
    Posts
    3

    Smile

    Dear Domenic,

    Thank you immensely! Problem is solved!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1