Newbie
Newbie

Reputation: 771

Dynamically extract string in excel

I have a column called 'cArticle' in excel, containing data in below format. I have a requirement to extract in another column the code that is in brackets. Ex- Z1A,F5C,etc

cArticle
Molecular Dispersion (Z1A)
Acrona Perse (F5C)
Leco Spers (HLP)
Cullar Dipters (LPP)

I have managed to get it partially working by using the below formula, but it still returns with values with the closing brackets. How can I modify it to get the desired results?

RIGHT(cArticle,4)

Thank you in advance!

Upvotes: 0

Views: 62

Answers (2)

Terry W
Terry W

Reputation: 3257

If the string always ends with (XXX) and the content in the brackets is always 3 digit. You can also try:

=LEFT(RIGHT(cArticle,4),3)

Upvotes: 1

Ranga
Ranga

Reputation: 430

If your code is always at the farthest right and is only 3 characters long, you can use formula as below

=SUBSTITUTE(RIGHT(cArticle,4),")","")

However if your code is not always at the farthest right and may be more or less than 3 characters than you can use formula below, which will work in all cases even if there is no code present

=IFERROR(MID(cArticle,FIND("(",cArticle)+1,FIND(")",cArticle)-FIND("(",cArticle)-1),"No Code")

sample1

Upvotes: 0

Related Questions