[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Removing all letters after a number in a cell

Posted on 2012-09-14
Medium Priority
310 Views
I have a cell that has "SRF-08 Cat Code 6_Earl Morris" or "SRF-08 Cat Code 9 Kirby Balfour Ag Consign"  I want to return "Cat Code #" in one cell, "Name" in the next cell, if there is a descripion after the name "Ag Consign" (otherwise blank) in the next cell and "SRF-##" in another can this be done with a function? I need 4 formulas
0
Question by:Jenedge73
• 3
• 3
• 2

LVL 23

Accepted Solution

NBVC earned 2000 total points
ID: 38399892
Assuming data starts in A1,

Then in B1:E1 enter these to extract your info:

=LEFT(A1,FIND(" ",A1)-1)

=TRIM(MID(SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("Cat Code",A1)+9,255),"_"," ")," ",REPT(" ",100)),1,100))

=TRIM(MID(SUBSTITUTE(SUBSTITUTE(MID(A1,FIND("Cat Code",A1)+9,255),"_"," ")," ",REPT(" ",100)),100,200))

=TRIM(MID(A1,FIND(D1,A1)+LEN(D1),255))

each copied down.
0

LVL 39

Expert Comment

ID: 38399975
assuming your data is in cell A2 and that the underscore after your cat code is a fluke.

for SRF-##
=left(a2, 6)
for cat code # (up to two digits)
=trim(mid(a2,17,2))
for name assuming first + last name, no compound names
=LEFT(RIGHT(A2,LEN(A2)-18),IFERROR(FIND(" ",SUBSTITUTE(RIGHT(A2,LEN(A2)-18)," ","|",1)),LEN(A2)))
for description, with the same assumptions
=IF(LEN(A2)-LEN(SUBSTITUTE(A2," ",""))>5,MID(A2,1+FIND("|",SUBSTITUTE(A2," ","|",6)),LEN(A2)),"")

Thomas
0

Author Comment

ID: 38400104
the underscore will never change positions, however sometimes it could be a space
the description can either be there or not
0

LVL 23

Expert Comment

ID: 38400125
My suggestion covers that possibility...
0

Author Comment

ID: 38400175
Thanks, seems to work great
0

LVL 23

Expert Comment

ID: 38400198
Did you get the right one?....
0

Author Comment

ID: 38400248
no i didn't.  do you know how to change the solution?
0

LVL 39

Expert Comment

ID: 38400256
Press the Request Attention link and a mod will magically appear and reopen the question, especially if you ask nicely.

Thomas
0

## Featured Post

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns overâ€¦
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
###### Suggested Courses
Course of the Month18 days, 12 hours left to enroll