+ Reply to Thread
Results 1 to 4 of 4

Char Input w/Multiple IFs

Hybrid View

  1. #1
    Registered User
    Join Date
    04-08-2017
    Location
    N/A
    MS-Off Ver
    2016
    Posts
    30

    Char Input w/Multiple IFs

    Hello,

    I have an input data for dates in a text (General) format in dd/mm/yyyy format with the only exception that it does not have "0" in front of the single digit numbers for the corresponding days and months (e.g. 1.3.2017, 11.3.2017, 11.3.2017 etc.).

    I will appreciate your help on making those single digit numbers a two digit number with 0 being the first digit. Not sure if multiple nested IFs w/Concatenate formula is the most intelligent solution here. I tried building such type of formula, but haven't been able to obtain all of the cases. There's probably more clever approach to use.

    Please find attached a spreadsheet with example.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Char Input w/Multiple IFs

    Try this one
    Enter in E2 and copy down
    Formula: copy to clipboard
    =TEXT(LEFT(D2,FIND(".",D2)-1),"00")&"."&TEXT(SUBSTITUTE(MID(D2,FIND(".",D2)+1,2),".",""),"00")&"."&RIGHT(D2,4)

    Here is a little bit shorter version
    Formula: copy to clipboard
    =TEXT(LEFT(D2,FIND(".",D2)),"00.")&TEXT(MID(D2,FIND(".",D2)+1,7),"00.0000")
    Last edited by AlKey; 01-28-2018 at 12:20 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Registered User
    Join Date
    04-08-2017
    Location
    N/A
    MS-Off Ver
    2016
    Posts
    30

    Re: Char Input w/Multiple IFs

    Quote Originally Posted by AlKey View Post
    Here is a little bit shorter version
    Formula: copy to clipboard
    =TEXT(LEFT(D2,FIND(".",D2)),"00.")&TEXT(MID(D2,FIND(".",D2)+1,7),"00.0000")
    Thank you.

  4. #4
    Registered User
    Join Date
    04-08-2017
    Location
    N/A
    MS-Off Ver
    2016
    Posts
    30

    Re: Char Input w/Multiple IFs

    @AlKey

    Great stuff. Cheers!

+ 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] Input Box char limit and Find to specific column
    By amein in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-20-2016, 08:06 AM
  2. [SOLVED] Writo cell if right 5 char input value exist
    By turist in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-09-2014, 08:16 AM
  3. [SOLVED] Add Special Char to input value
    By turist in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2013, 01:46 PM
  4. Password Char to Input Box
    By ravi_m5_2000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2009, 11:40 AM
  5. Changing a single Char in a string to another ASCII char
    By goofy78270 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2007, 09:45 AM
  6. Replies: 6
    Last Post: 03-10-2006, 01:15 PM
  7. Workbooks.OpenText dropping last char from input
    By John Keith in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2005, 11:05 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