+ Reply to Thread
Results 1 to 6 of 6

Thread: Date help required in Excel IF/DO

  1. #1
    Registered User
    Join Date
    01-26-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Date help required in Excel IF/DO

    Hello,
    I am updating a daily checklist and wish to have the date automatically update when we print it off each day.
    I know the =today() command will do this.
    However, on the weekends we print off one checklist for Saturday and Sunday combined.
    How can I set it up so that on mon -fri I get the current days date, but if it is a Saturday, I want Saturdays and Sundays date both
    shown on the checklist.

    Thanks!
    Lee

  2. #2
    Valued Forum Contributor
    Join Date
    06-09-2010
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    346

    Re: Date help required in Excel IF/DO

    I dare say one of the forum gurus will have a more economical solution, but this should work
    you can insert your preferred date format in place of "dd mmm yy" if you like

    =IF(WEEKDAY(TODAY())=7,TEXT(TODAY(),"dd mmm yy")&" and "&TEXT(TODAY()+1,"dd mmm yy"),IF(WEEKDAY(TODAY())=1,TEXT(TODAY()-1,"dd mmm yy")&" and "&TEXT(TODAY(),"dd mmm yy"),TODAY()))

  3. #3
    Registered User
    Join Date
    01-26-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Date help required in Excel IF/DO

    Thanks Nicky,
    Can I ask if I want a full date eg Saturday, 28 January 2012 format, what should I put in place of the "dd mm yy" you have used in your example?
    I am testing your suggestion, and so far I got it to work with my preferred format just by format cells/date and specifying it in there.

  4. #4
    Valued Forum Contributor
    Join Date
    06-09-2010
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    346

    Re: Date help required in Excel IF/DO

    Hi
    formatting the cells will work fine for dates that are also numbers, but when you change the cell content to text (necessary to include two separate dates and "and " in one cell) you will need to specify the number format of each date separately.

    for Friday, 27 January 2012 use

    "dddd, dd mmmm yyyy"
    Last edited by NickyC; 01-27-2012 at 02:36 AM. Reason: typo

  5. #5
    Registered User
    Join Date
    01-26-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Date help required in Excel IF/DO

    this has worked a treat! Thanks Nicky.
    I have come across another issue though. On the weekend checklist (with the 2 dates), I require the dates to be one above the other. This is because I have run out of room having the 2 dates on the same line. Is there a way to make a new line? (in the same cell is ok). I have editted Nicky's code a little to change the date format. Here it is:
    =IF(WEEKDAY(TODAY())=7,TEXT(TODAY(),"dddd, dd mmmm yyyy")&" and "&TEXT(TODAY()+1,"dddd, dd mmmm yyyy"),IF(WEEKDAY(TODAY())=1,TEXT(TODAY()-1,"dddd, dd mmmm yyyy")&" / "&TEXT(TODAY(),"dddd, dd mmmm yyyy"),TODAY()))

  6. #6
    Valued Forum Contributor
    Join Date
    06-09-2010
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    346

    Re: Date help required in Excel IF/DO

    Hi
    you can do this using Char(10), which includes a carriage return in your formula - but it only works if the cell's format is set to "wrap text".

    Try this:


    =IF(WEEKDAY(TODAY())=7,TEXT(TODAY(),"dddd, dd mmmm yyyy")&"/"&CHAR(10)&TEXT(TODAY()+1,"dddd, dd mmmm yyyy"),IF(WEEKDAY(TODAY())=1,TEXT(TODAY()-1,"dddd, dd mmmm yyyy")&"/"&CHAR(10)&TEXT(TODAY(),"dddd, dd mmmm yyyy"),TODAY()))

+ 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.2.0