+ Reply to Thread
Results 1 to 6 of 6

If statement using dates.

  1. #1
    Registered User
    Join Date
    09-16-2014
    Location
    Cape Town
    MS-Off Ver
    Office 2010
    Posts
    3

    If statement using dates.

    Hi Everyone, I am sorry if this topic has been discussed before. I looked through a couple of threads, but could not see anything for my needs.

    I have Five columns, The first four columns contains dates for the last document received per document.

    Now in the 5 column, I would like to add an If statement that will automatically pull in the latest date of the four columns in that row.

    Please advise if anyone can assist or if more info is needed.

    Looking forward to your answers.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: If statement using dates.

    You don't need an IF statement.

    A date is simply a number ... the number of days starting at 01/01/1900. Therefore, you can just use MAX.

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-16-2014
    Location
    Cape Town
    MS-Off Ver
    Office 2010
    Posts
    3

    Re: If statement using dates.

    Quote Originally Posted by TMS View Post
    You don't need an IF statement.

    A date is simply a number ... the number of days starting at 01/01/1900. Therefore, you can just use MAX.

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regards, TMS
    Thank you!

    I presume then, that there can only be dates or numbers in the data, otherwise the results will be effected?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: If statement using dates.

    You said
    I have Five columns, The first four columns contains dates ...
    It will ignore empty cells, spaces or alphabetic characters. If you put in a number other than a date, yes, it may affect the result.

    A date in the year 2014 will be greater than or equal to 41640. So, if you were to put in a number like 999, it probably wouldn't make a difference. On the other hand, if you were to put a number like 99999, you would get a date value = 13/10/2173.

    Regards, TMS

  5. #5
    Registered User
    Join Date
    09-16-2014
    Location
    Cape Town
    MS-Off Ver
    Office 2010
    Posts
    3

    Re: If statement using dates.

    Quote Originally Posted by TMS View Post
    You said

    It will ignore empty cells, spaces or alphabetic characters. If you put in a number other than a date, yes, it may affect the result.

    A date in the year 2014 will be greater than or equal to 41640. So, if you were to put in a number like 999, it probably wouldn't make a difference. On the other hand, if you were to put a number like 99999, you would get a date value = 13/10/2173.

    Regards, TMS
    Thank you, It worked perfectly.

    Is it possible when doing thing, that it also take the cells format (specifically the colour of the cell)?

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: If statement using dates.

    You're welcome. Thanks for the rep.


    Is it possible when doing thing, that it also take the cells format (specifically the colour of the cell)?
    Not AFAIK.

    You might be able to do something with Conditional Formatting. Match the MAX value against the dates in the column and, depending on the number (1 to 4), add a colour. But that wouldn't necessarily be the colour of the original cell, just a colour relating to the column. If the columns have specific colours, that might work. That would require 4 CF conditions.

    Regards, TMS

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. HELP! IF statement containing DATES
    By ohiamluis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-08-2013, 01:05 PM
  2. If statement with Dates
    By ktkreeger in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-02-2013, 04:26 PM
  3. Excel 2007 : Using Dates in an IF Statement
    By The_Snook in forum Excel General
    Replies: 3
    Last Post: 05-11-2012, 05:55 AM
  4. [SOLVED] IF statement with two dates
    By jbormann in forum Excel General
    Replies: 2
    Last Post: 07-18-2006, 12:32 PM
  5. If Statement and Dates
    By Toys in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-21-2005, 08:35 AM

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