+ Reply to Thread
Results 1 to 10 of 10

Convert With Dashes

  1. #1
    Banned User!
    Join Date
    09-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    607

    Convert With Dashes

    Hello all,

    Is there a way to convert this data from before to after applying dashes where lacking?

    Before After
    P-008037 P-008037
    P26903 P-26903
    P77897 P-77897
    P2070 P-2070
    P2048 P-2048
    P4551 P-4551
    W2059:001 W-2059:001
    W2044:001 W-2044:001
    W1169:001 W-1169:001
    W1779:001 W-1779:001
    P-1969 P-1969
    P-4623 P-4623
    P4768 P-4768
    P4084 P-4084

    Thank you for any help

  2. #2
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Convert With Dashes

    see attached.
    Attached Files Attached Files

  3. #3
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Convert With Dashes

    You can try with PowerQuery add-in for Ex2010
    Attached Files Attached Files

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

    Re: Convert With Dashes

    Try this ...

    =IF(MID(A1,2,1)="-",A1,REPLACE(A1,2,0,"-"))

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Convert With Dashes

    Another option just for the fun of it

    =IF(COUNTIF(A2,"?-*"),A2,LEFT(A2)&"-"&RIGHT(A2,LEN(A2)-1))

  6. #6
    Banned User!
    Join Date
    09-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    607

    Re: Convert With Dashes

    My before data is in column E starting at row 2. How can the mid formula be adjusted please?

  7. #7
    Banned User!
    Join Date
    09-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    607

    Re: Convert With Dashes

    I got it thanks so much.

    =IF(MID(E2,2,1)="-",E2,REPLACE(E2,2,0,"-"))

    Is there a way to force the user to this format?

    P- or W-

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Convert With Dashes

    Quote Originally Posted by Billy Spivy View Post

    Is there a way to force the user to this format?

    P- or W-
    You can use Data Validation. If your data is in E2:E10, highlight E2:E10 > Data Validation > Settings > Allow: Custom > Formula: =COUNTIF(E2,"?-*") > OK

    If you only wanted to allow for P or W, you can adjust the formula to this: =COUNTIF(E2,"P-*")+COUNTIF(E2,"W-*")
    Last edited by 63falcondude; 10-06-2017 at 09:30 AM.

  9. #9
    Banned User!
    Join Date
    09-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    607

    Re: Convert With Dashes

    Great thank you for all of the help.

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Convert With Dashes

    Glad we could help.

+ 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. Replies: 3
    Last Post: 01-17-2014, 08:08 PM
  2. 0s as dashes but more complicated
    By Jadyny in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-26-2013, 01:00 PM
  3. [SOLVED] Getting rid of some dashes
    By Ryanreid in forum Excel General
    Replies: 4
    Last Post: 08-21-2012, 12:21 PM
  4. Convert "0" into "-"(Dashes)
    By hardeep.kanwar in forum Excel General
    Replies: 4
    Last Post: 08-30-2009, 11:40 AM
  5. Replies: 1
    Last Post: 05-14-2008, 07:55 PM
  6. [SOLVED] Convert phone numbers with dashes in them to just numbers
    By J H in forum Excel General
    Replies: 2
    Last Post: 06-23-2006, 02:00 PM
  7. [SOLVED] Convert phone numbers with dashes in them to just numbers
    By J H in forum Excel General
    Replies: 2
    Last Post: 06-22-2006, 09:45 PM
  8. Stripping the dashes
    By digital21st in forum Excel General
    Replies: 4
    Last Post: 05-23-2006, 10:50 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