+ Reply to Thread
Results 1 to 5 of 5

Between 2 dates display x

  1. #1
    Registered User
    Join Date
    02-05-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Between 2 dates display x

    Hi all,

    I have a column full of dates. I want to create a formula that looks at a cell in this column, and if it's between to certain dates then i want to display a value.

    So for example: if the date in cell C4 is between 01/04/11 and 30/04/11, display 'Period 1'.

    If its also possible i would like to add further sub functions, so using the above, if the date in cell C4 isn't between those 2 dates, but is between 01/05/11 and 28/05/11, display 'Period 2'.

    Thanks in advance.
    Last edited by joebloggs21; 03-22-2011 at 09:21 AM. Reason: Problem Solved

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Between 2 dates display x

    Hello,

    If you define a simple lookup table with the threshold dates for the periods, then the formula can be as simple as this:

    =VLOOKUP(C1,$H$1:$I$3,2,TRUE)

    See attached. The #N/A values in the first few rows mean that the date value is not found in the lookup table in columns H and I. The error value can be suppressed or replaced with a more meaningful message, if required.

    cheers,
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    02-05-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Between 2 dates display x

    Thank you. This seems to have worked only for Period 13 dates for some reason, the rest are displaying #N/A. I used the VLOOKUP table below:

    14/11/2011 Period 9
    12/12/2011 Period 10
    09/01/2011 Period 11
    06/02/2011 Period 12
    06/03/2011 Period 13
    01/04/2011 Period 1
    01/05/2011 Period 2
    29/05/2011 Period 3
    26/06/2011 Period 4

    I was only expecting results for Period 10-Period 13, but only Period 13 is showing.

    Thanks.

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Between 2 dates display x

    You need to sort your lookup table in ascending order, with the earliest date at the top.

    see attached
    Attached Files Attached Files
    Last edited by teylyn; 03-22-2011 at 07:12 AM.

  5. #5
    Registered User
    Join Date
    02-05-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Between 2 dates display x

    Ah i see! The first 2 dates were meant to be 2010!

    Thanks a lot for your help, much appreciated.

+ 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