Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Add Hyphens to alphanumeric sting of data in Excel 2016

0

Hello - I want to format this string in a cell to go from DAAB0708DD001 to DAAB07-08-D-D001  How can I do this using a formula.

Thank you! 

Answer
Discuss

Answers

0
Selected Answer

I started with your string (DAAB0708DD001) in Cell A1, then in B1 I used the formula " =LEFT(A1,6)&"-"&MID(A1,7,2)&"-"&MID(A1,9,1)&"-"&MID(A1,10,5)"  [without the quotes].  you use the apersand character "&" as concatenating, the create string forumlas to connect the rest with the dash "-" character in between.

Discuss

Discussion

Thank you! Worked perfectly. 
Cindy525469 (rep: 4) Aug 28, '17 at 1:37 pm
Add to Discussion
0

Or a shorter version.

=REPLACE(REPLACE(REPLACE(A1,7,0,"-"),10,0,"-"),12,0,"-")

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login