+ Reply to Thread
Results 1 to 8 of 8

Can Excel return the earliest date using =IF?

  1. #1
    Registered User
    Join Date
    04-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Can Excel return the earliest date using =IF?

    Hi all

    I have been doing a bit of searching on the web but cant seem to find the exact answer I am looking for, or if I have found something my knowledge is not quite up to scratch as how to change said formula to suit my needs.

    At work my colleague and I have basically created an excel appointments diary to book patients into.

    We have separate sheets per physician and on these sheets we have created a 'box' for each date. With each of the box's we have a count function to return the number of booked, available and cancelled spaces.

    What we want to do is have a formula that returns to us the earliest possible date with space available. Effectively we have this:

    Date # of patients
    1.4.09 0
    3.4.09 0
    20.4.09 8
    21.4.09 1
    21.4.09 0
    23.4.09 12
    24.4.09 4
    27.4.09 9
    28.4.09 8
    30.4.09 14

    What formula would you suggest using? I did try using a nested IF function i.e. =IF(B1>=1,A1,value_if_false, IF(B2>=1,A2,value_if_false)). The value_if_false is what I had a problem with as if it is false I wanted the formula to look for the next date available with spaces. I always got a 'too many arguments' error returned.

    Any help would be much appreciated, or just pointing me into the right direction would be great.

    Cheers

    Jared

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Can Excel return the earliest date using =IF?

    Hi and welcome to the board,

    what do you exactly mean by " space available"? number of patients = 0?

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Can Excel return the earliest date using =IF?

    No, i misread the problem, thrown off by the title of the thread, My apologies.
    Last edited by JBeaucaire; 04-01-2009 at 04:28 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    04-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Can Excel return the earliest date using =IF?

    Thanks

    Sorry, looking at my post I appear to have named it wrong I meant to put number of spaces!

    Date # of spaces
    1.4.09 0
    3.4.09 0
    20.4.09 8
    21.4.09 1
    21.4.09 0
    23.4.09 12
    24.4.09 4
    27.4.09 9
    28.4.09 8
    30.4.09 14

    So 0 meaning no appointment slots for patients and anything >0 having slots available.

    Cheers

    Jared

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Can Excel return the earliest date using =IF?

    If you can provide a simple key noting which days are full, then INDEX/MATCH on the word "Free" to bring back the date that matches the first instance of "free space."
    Attached Files Attached Files
    Last edited by JBeaucaire; 04-01-2009 at 04:37 AM. Reason: Added OPs new requirements into sheet

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Can Excel return the earliest date using =IF?

    Or, you can use a MIN(IF( array assuming dates are date values

    =MIN(IF(B1:B100>0,A1:A100))
    committed with CTRL + SHIFT + ENTER

    Where B1:B100 contains spaces and A1:A100 dates.

  7. #7
    Registered User
    Join Date
    04-01-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Can Excel return the earliest date using =IF?

    Thanks all for the rapid replys! I have now sorted my problem. Now I just need to improve my knowledge of excel... trial and error!

    JBeaucaire: Thanks for that, works a treat!

    Jared

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Can Excel return the earliest date using =IF?

    If that takes care of your need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [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