Solved

Extract text from a string

Posted on 2013-11-08
3
299 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
Comment
Question by:thutchinson
3 Comments
 
LVL 50

Assisted Solution

by:barry houdini
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

by:
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)),"")

Open in new window


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

Author Closing Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

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

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

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now