Strip out the DD- number from a string in Excel


I have rows of data like this:

Y:\2222_sa3pru4e\DD-0093697 - sap3r5ue - FG0 - SELF - Warsaw\1 - Project Checklist\
Y:\2222_ga2ll3om2\DD-0094119 - gall3o4m2 - FG0 - SELF \1 - Project Checklist\
Y:\2222_gu2te3tr\DD-0084608 - gut3etr - FG0 - SELF \1 - Project Checklist\
Y:\2222_st4e3phl1\DD-4308967 - st7ep5hl1 - FG0-LT16Hrs - SELF \1 - Project Checklist\
Y:\2222_ga2n3a\DD-0498678 - ga7n5a - FG1 - SELF \1 - Project Checklist\
Y:\2222_b333o33ydb\DD-0087585 - b5oydb - FG1 - SELF \1 - Project Checklist\
Y:\2222_va3nder8\DD-0089070 - v5ander8 - FG2 - SELF \1 - Project Checklist\
Y:\2222_du32n3nig\DD-0090708 - dun74nig - FG2 - SELF \1 - Project Checklist\
Y:\2222_sharerma13\DD-0056635 - sha4rma13 - FG0 - SELF \1 - Project Checklist\
Y:\2222_watrssek\DD-0094288 - wa45s5sek - FG0 - ESELF \1 - Project Checklist\
Y:\2222_s4t4ahls\DD-0091953 - st5ah4ls - FG1 - SELF \1 - Project Checklist\
Y:\2222_sta4hls\DD-0084569 - st45ah5ls - FG1 - SELF \1 - Project Checklist\
Y:\2222_h4ondb\DD-0084928 - 4ho5ndb - FG1 - SELF \1 - Project Checklist\
Y:\2222_le4vy4m1\DD-0059075 - levy54m1 - FG2 - SELF \1 - Project Checklist\
Y:\2222_m34ertcelvm1\DD-0093744 - 3mce5lv4m1 - SELF  - SELF \1 - Project Checklist\
Y:\2222_mcert435elvm1\DD-0092970 - m7cel5v45m1 - SELF  - SELF \1 - Project Checklist\
Y:\2222_mcertelvm1\DD-0093690 - m4celv44m1 - SELF  - SELF \1 - Project Checklist\

As you can see there is a DD- number in each of the strings - how can I strip out the DD- number? I would like to take the DD- and the post fixed 7 digit number and output the list somewhere in a list!

Can this be done via Macro/VBA or formula alone?


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
Assuming you have this in A1 and so on..

then in B1 apply this formula and simply drag this..


This will do what you are looking for...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob HensonFinance AnalystCommented:
Saurabh, that doesn't quite answer the question; asker wants only the 7 digits without the DD-.

Slight amendment:


Saurabh Singh TeotiaCommented:

I dont think so... if you see this...

As you can see there is a DD- number in each of the strings - how can I strip out the DD- number? I would like to take the DD- and the post fixed 7 digit number and output the list somewhere in a list!

He said he want to take out the DD number out with DD- and 7 digits post that....

OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Rob HensonFinance AnalystCommented:
I read this:

and the post fixed 7 digit number and output the list somewhere in a list!

as requiring just the 7 digits.

Lets wait for asker to come back.

Rob H
gisvpnAuthor Commented:
Hello and thank you for your posts! I will try these they both would work for me;) I am going to apply to the spreadsheet and will let you know if there are any problems! :)
gisvpnAuthor Commented:
Hi Rob,

Would you be able to help me with what the functions you have used are ? The ones called right, mid and find and how the formula works please ;)?
Saurabh Singh TeotiaCommented:

right works from the right side of the cell and trucnates the value to number of characters you specify in the same so for instance if you cell A1 has ABC and you apply below mentioned formula...

=Right(A1,2) --> This will give you BC as the answer.

Similarly MID works from the left side and it picks the number of characters that you want to pick so for instance lets say i want to just pick B from ABC i will write


In the above formula 2 is the starting point and from that point i want to pick 1 character.

Now Find works if you want to find any particular value in your data now, Lets say in the same cell i want to find whether B exists or not.. I can use...


In the above formula 1 is the point of character from where i want to start ..This will give me an answer where B is found in the data basically it's position..

You can do the same thing with =Search("b",A1,1)

The difference between find and search is that find is case sensitive so what i mean by that if i say =find("b",A1,1) this will give me an error since b is caps where as i'm looking for lower caps.

Now what both me and rob are doing we are finding where "DD" exists in your value and from their picking up the necessary values which we want to retrieve accordingly...

Hope this helps..

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.