+ Reply to Thread
Results 1 to 13 of 13

Combining two dates formula using IF condition

  1. #1
    Registered User
    Join Date
    01-13-2011
    Location
    bangalore,india
    MS-Off Ver
    Microsoft 365 MSO (Version 2208 Build 16.0.15601.20858) 64-bit
    Posts
    24

    Combining two dates formula using IF condition

    Hello Gurus,

    I have challenge converting the Text to Date format, i have DMMYYYY, DDMYYYY, DDMMYYYY date formats.

    I have two text with Len=7, ex: 0422024, 4102024, the result should be 04022024 and 04102024.

    I got the formula, but i want to combine two formulas by using IF condition.

    in C1 the the output should be =If (Len(A1)=7, then Date formula1 (B1) or Date formula 2 (B2))

    thanks

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Combining two dates formula using IF condition

    Are you still using Excel 2010?

    There is no way that Excel can determine accurately how to divide up those first three numbers in the string.
    Last edited by AliGW; 03-19-2024 at 02:26 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Combining two dates formula using IF condition

    What should 1212024 by converted to... and why?

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,911

    Re: Combining two dates formula using IF condition

    Hi,

    If A1 is 1112024, is your expected result 01112024 or 11012024?

  5. #5
    Registered User
    Join Date
    01-13-2011
    Location
    bangalore,india
    MS-Off Ver
    Microsoft 365 MSO (Version 2208 Build 16.0.15601.20858) 64-bit
    Posts
    24

    Re: Combining two dates formula using IF condition

    Thanks for your quick reply.

    @AliGw, I have changed to MS 365 as my Excel version
    @Rick, 1212024 to 01212024 as MMDDYYYY
    @phuocam, the expected result should be 01112024

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Combining two dates formula using IF condition

    You are missing my point.

    In the case of 111 as the three opening numbers, HOW is Excel meant to decide whether this represents the first of the eleventh or the eleventh of the first? In other words, how does it know that it should be 01112024 and not 11012024?

    What should 1212024 by converted to... and why?
    That one is clear - must be 12012024 because we are working in DDMMYYYY format. Can't be the first of the 24th.
    Last edited by AliGW; 03-19-2024 at 03:05 AM.

  7. #7
    Registered User
    Join Date
    01-13-2011
    Location
    bangalore,india
    MS-Off Ver
    Microsoft 365 MSO (Version 2208 Build 16.0.15601.20858) 64-bit
    Posts
    24

    Re: Combining two dates formula using IF condition

    Hi Ali, By default in my source the 1112024 is DDMYYYY, please see the attachment, i hope it give you the understanding

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Combining two dates formula using IF condition

    Why on EARTH are you removing the / ??? That's causing you all of the problems!

    In F3 copied down:

    =DATE(TEXTAFTER(A3,"/",2),TEXTBEFORE(TEXTAFTER(A3,"/"),"/"),TEXTBEFORE(A3,"/"))

    This also works:

    =DATEVALUE(A3)
    Last edited by AliGW; 03-19-2024 at 03:42 AM. Reason: Workbook updated.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Combining two dates formula using IF condition

    No reply ...

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  10. #10
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Combining two dates formula using IF condition

    Try in F3 (for excel 2016 or older):
    Please Login or Register  to view this content.
    drag down
    Quang PT

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Combining two dates formula using IF condition

    Why? DATEVALUE works in 2003 and newer!

  12. #12
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Combining two dates formula using IF condition

    Quote Originally Posted by AliGW View Post
    Why? DATEVALUE works in 2003 and newer!
    with this:

    "for excel 2016 or older"

    I mean this formula for user who has 2016 or older (2016,2013,2007,2003...)
    = do not have 2019 or 365

  13. #13
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Combining two dates formula using IF condition

    Quote Originally Posted by AliGW View Post
    That one is clear - must be 12012024 because we are working in DDMMYYYY format. Can't be the first of the 24th.
    First of the 24th??? I know the question has moved on, but look at the number I posted again... 1212024 It could be converted to either 01212024 or 12012024, hence the question I asked.

+ 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. [SOLVED] Combining sheets dates to summary - Formula Error
    By Ravindran Raman in forum Excel General
    Replies: 5
    Last Post: 10-20-2023, 04:57 AM
  2. [SOLVED] Formula using if condition based on dates
    By skml in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-08-2022, 05:59 AM
  3. [SOLVED] IF formula to check value between two dates, add another condition
    By bfaws in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-26-2021, 10:59 AM
  4. [SOLVED] Condition Formula between dates then sum if meets between those dates
    By rhett7660 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-30-2017, 03:52 PM
  5. [SOLVED] Dates w/in 48 hours of each other formula/condition
    By JRose0303 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-05-2016, 01:28 PM
  6. Formula for parsing and combining dates
    By mjwmedia in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-20-2014, 10:58 PM
  7. formula for combining multiple dates, from columns to rows
    By juliomanco in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-29-2012, 06:21 PM

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