+ Reply to Thread
Results 1 to 8 of 8

Next date after Today()

Hybrid View

Lizabeta Next date after Today() 01-20-2009, 03:52 PM
DonkeyOte entered as an array with CTRL... 01-20-2009, 04:19 PM
Lizabeta When do you use the... 01-20-2009, 06:09 PM
Lizabeta Thank you!!! It's all... 01-20-2009, 07:15 PM
DonkeyOte Not sure which you adopted... 01-21-2009, 04:28 AM
Lizabeta I went and found the... 01-21-2009, 08:14 PM
martindwilson i think you will have to sort... 01-20-2009, 04:27 PM
daddylonglegs You could use just ... 01-20-2009, 05:31 PM
  1. #1
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    entered as an array with CTRL + SHIFT + ENTER

    A1: =IF(COUNTIF(H2:H10,">"&TODAY()),MIN(IF(H2:H10>TODAY(),H2:10)),"")

    once array has been setup the above will appear encased within { }

  2. #2
    Registered User
    Join Date
    12-19-2008
    Location
    CA
    Posts
    64
    Quote Originally Posted by DonkeyOte View Post
    entered as an array with CTRL + SHIFT + ENTER

    A1: =IF(COUNTIF(H2:H10,">"&TODAY()),MIN(IF(H2:H10>TODAY(),H2:H10)),"")

    once array has been setup the above will appear encased within { }

    When do you use the Ctrl/shift/enter? Instead of Enter? Before ctrl-v?

    EDIT: Nvm. got it. If you use Ctrl / Shift/ Enter as often as you can, eventually, one of them will work.
    /e mumbles something about a million monkeys on a million keyboards will eventually...
    Last edited by Lizabeta; 01-20-2009 at 06:12 PM.

  3. #3
    Registered User
    Join Date
    12-19-2008
    Location
    CA
    Posts
    64
    Thank you!!!

    It's all settled!


    Just out of curiosity, and so to further my brain development instead of regurgitating formulas.... Could you interpret that formula into plainspeak?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    Not sure which you adopted but this:

    =IF(COUNTIF(H2:H10,">"&TODAY()),MIN(IF(H2:H10>TODAY(),H2:H10)),"")
    Can be broken down into 3 "BITS"

    First:

    =IF(COUNTIF(H2:H10,">"&TODAY()),do if true, do if false)
    So the above will count how many dates in the range specified exceed Today's date - the result will be an integer value between 0 and 9... it's important to note that only the value 0 equates to FALSE in XL and so it follows that should the result of the COUNTIF be anything other than 0 (1 to 9) then this equates to TRUE

    So let's assume answer is > 0*, do TRUE action, SECOND BIT, namely:
    *based on sample data shown further down

    MIN(IF(H2:H10>TODAY(),H2:H10))
    So the above is basically going through the range H2:H10 and creating an array of values, where the value of H2:H10 > TODAY that date will be added to the array, if it is <= TODAY() a Boolean of FALSE will be added to the array, so if we assume H2:H10 values of:

    H2: 1/5/09
    H3: 1/6/09
    H4: 1/13/09
    H5: 1/14/09
    H6: 1/19/09
    H7: 1/15/09
    H8: 1/22/09
    H9: 1/27/09
    H10: 1/8/09
    And a current date of 1/21 we will end up with an array of values as so:

    {FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,"1/22/09","1/27/09",FALSE)
    Note: that in the above the dates are shown in this way for illustrative purposes, in reality dates are integer values ... on 1900 date system 1/22/09 = 39835 and 1/27/09 = 39840 and these integer values are to all intents and purposes the values held in the array.

    We then run the MIN against the above array to return the lowest value from the range as this equates to the earliest date - the logicals (FALSE) will be ignored so we get Jan 22 returned.

    If today were 1/27 then the result of our initial COUNTIF would be 0, ie FALSE, in which case the FALSE action of the IF function would be actioned, THIRD BIT, namely:

    ""
    ie return blank


    If you ever need to work through a formula be sure to check out the "Evaluate Formula" option in XL which permits you to step through how a given formula is calculated -- it is a superb and often overlooked utility IMO and is handy for all users regardless of supposed expertise.
    Last edited by DonkeyOte; 01-21-2009 at 04:34 AM.

  5. #5
    Registered User
    Join Date
    12-19-2008
    Location
    CA
    Posts
    64
    Quote Originally Posted by DonkeyOte View Post
    If you ever need to work through a formula be sure to check out the "Evaluate Formula" option in XL which permits you to step through how a given formula is calculated -- it is a superb and often overlooked utility IMO and is handy for all users regardless of supposed expertise.
    I went and found the 'Evaluate Formula' option and while I will definitely keep it in mind for another day... you are exponentially more coherent and helpful.

    Thank you for the breakdown!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1