+ Reply to Thread
Results 1 to 7 of 7

How to fixed date & time format conditionally

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    640

    How to fixed date & time format conditionally

    If cell A1:A having text like (blank), then cell B1:B will be current date – 1 space 23:59 (example: 2/23/2013 23:39 ).
    Please remember that always date & time format will be MM/DD/YYYY HH:MM
    My actual data like following
    CELL A               CELL B
    2/20/2013 6:57	2/20/2013 6:57
    (blank)	        2/23/2013 11:33
    2/20/2013 8:05	2/20/2013 8:05
    I need to convert like below
    CELL A               CELL B
    2/20/2013 6:57	2/20/2013 6:57
    (blank)	        2/23/2013 23:59
    2/20/2013 8:05	2/20/2013 8:05
    I have tried something like below formula
    B1=IF(A1="(blank)",NOW()-1,A1)
    B2=IF(A2="(blank)",NOW()-1,A2) ' here i want to keep current date-1 23:59
    B3=IF(A3="(blank)",NOW()-1,A3)
    ..............................

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: How to fixed date & time format conditionally

    Hi Nur,

    Try below formula:-

    Formula: copy to clipboard
    =IF(A1="",TODAY()-1+TIME(23,59,0),A1)


    format at the cell as per your format... thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    640

    Re: How to fixed date & time format conditionally

    Hi, dilipandey, thanks for mail, it is not correct please check below comments
    "(blank)" is not actually blank, it is text(7 characters text data ), so don't treat it as blank

  4. #4
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    640

    Re: How to fixed date & time format conditionally

    Hi, dilipandey,
    I got your point, Many thanks for helping me , it is something like
    B1=IF(A1="(blank)",TODAY()-1+TIME(23,59,0),A1)

  5. #5
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: How to fixed date & time format conditionally

    change code dilipandey with this

    =IF(TRIM(A1)="(blank)",TODAY()-1+TIME(23,59,0),A1)
    Click (*) if you received helpful response.

    Regards,
    David

  6. #6
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    640

    Re: How to fixed date & time format conditionally

    hi, SDCh thanks

  7. #7
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: How to fixed date & time format conditionally

    You are welcome Nur2544... cheers

    Please mark this thread as [SOLVED].. Thanks.



    Regards,
    DILIPandey
    <click on below * if this helps>

+ 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