Solved

# Extract text from a string

Posted on 2013-11-08
339 Views
Last Modified: 2013-11-10
The product item number (ItemNo) that I need is buried in the product description (Description) field.

See sample file attached. Is there a way to run a macro or a procedure to extract the item number from COL and write it to Col B?

The item number is always at the end of the string but not all products have an item number. To demonstrate, I completed through row 8 manually.
Extract-ItemID-from-product-desc.xlsx
0
Question by:thutchinson
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions
3 Comments

LVL 50

Assisted Solution

barry houdini earned 250 total points
ID: 39633731
You can do this with a formula

Select B2 and format as general then paste this formula in B2

=IF(ISERR(RIGHT(A2)+0),"",TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(A2,")"," ")," ",REPT(" ",99)),99)))

drag formula down column......or just put cursor on bottom corner of B2 until you see a black "+" (the "fill-handle") now double click and the formula will populate all the way down automatically - see attached

regards, barry
Extract-ItemID-barry.xlsx
0

LVL 22

Accepted Solution

rspahitz earned 250 total points
ID: 39634079
Here's another formula to stick in column B (after you change the datatype back to General):

``````=IF(ISNUMBER(VALUE(RIGHT(A2,1))),TRIM(RIGHT(A2,6)),"")
``````

This assumes that the the numbers you seek are all 6 characters or less.
0

Author Closing Comment

ID: 39637073
Both these solutions worked fine. Thanks experts!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
###### Suggested Courses
Course of the Month6 days, 23 hours left to enroll

#### 734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.