Extract numerical value after certain text

Lee85

New Member
Joined
Jan 19, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hi

I am kinda new to this and I am hoping someone can help me
I would like to extract a numerical value after specific text
Example
Green 6 red 4
Green 8 blue 3
How would Ij extract just the 8 when the specific is Green and also is the word was Green and red

Hope this makes sense
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Welcome to MrExcel Message Board.
1. Are you want Only Extract 8 Or All numbers comes after Green?
2. For Green & Red, Example you want Extract only 6, OR 6 & 4 Separately at two cell OR Extract 64?
 
Upvote 0
Example
Book1
ABCD
1GreenGreen & Red
2green 6 Red 466, 4
3Green 8 Blue 388
4Green 777
5Blue 3 green 555
6Blue 5  
7
Sheet1
Cell Formulas
RangeFormula
B2:B6B2=IFERROR(TRIM(MID(A2,SEARCH("Green",A2,1)+5,2)),"")
C2:C6C2=IFERROR(TRIM(MID(A2,SEARCH("Green",A2,1)+5,2)),"")&IFERROR(", "&TRIM(MID(A2,SEARCH("Red",A2,1)+3,2)),"")
 
Upvote 0
Hi thanks for this it helped a lot
Now i am wondering how i would i go about changing this formula to split the below while look at my list as i only want the info that is in my list

Chl_CPick 4
Chl_Mar 6
CrM_CLN 4
Chl_C/B 4
ABS 4
Chl_C/B 4
CrM_CLN 4
Hol 4
my list is the following

Chl_CPick
Chl_Mar
Chl_Qd
Chl_Hyg
Chl_C/B
Chl_Train
Chl_Other
Chl_Meet
Chl_Nag1
Chl_Nag2
Chl_Nag3
Chl_Nag4
Chl_Nag5
CrE_CRec
CrM_CRec
CrN_CRec
CrE_CLN
CrE_CLS
CrM_CLN
CrM_CLS
CrN_CLN
CrN_CLS

Any help on this would be much appreciated
 
Upvote 0
Data at A1 and down (2 lines in each cell), the list at B1 and down, consider this formula at C1 and copy down,
=IFERROR(TRANSPOSE(SORT(TRIM(MID(SUBSTITUTE($A1,CHAR(10),REPT(" ",10)),LEN($B$1:$B$22)+FIND($B$1:$B$22,SUBSTITUTE($A1,CHAR(10),REPT(" ",10))),10)))),"")
 
Upvote 0
=IFERROR(TRANSPOSE(SORT(TRIM(MID(SUBSTITUTE($A1,CHAR(10),REPT(" ",10)),LEN($B$1:$B$22)+FIND($B$1:$B$22,SUBSTITUTE($A1,CHAR(10),REPT(" ",10))),10)))),"")
Keeps coming up That function is not valid and then highlights the sort value
 
Upvote 0
Please upload your example file with XL2BB ADDIN at above of reply section OR upload it at free uploading site e.g. www.dropbox.com or googledrive or onedrive and insert link here.
 
Upvote 0
Try this:
NewRun.xlsm
ABCDEF
1After Nth Space
21234
3Chl_Cpick 4 Chl_Mar 6Chl_Cpick4Chl_Mar6
4CrM_CLN 4 Chl_C/B 4CrM_CLN4Chl_C/B4
5ABS 4 Chl_C/B 4ABS4Chl_C/B4
6CrM_CLN 4 Hol 4CrM_CLN4Hol4
7
Sheet3
Cell Formulas
RangeFormula
B3:B6B3=LEFT(A3,FIND(" ",A3,1)-1)
C3:D6C3=MID($A3,FIND("~",SUBSTITUTE($A3," ","~",B$2))+1,FIND("~",SUBSTITUTE($A3," ","~",C$2))-FIND("~",SUBSTITUTE($A3," ","~",B$2))-1)
E3:E6E3=RIGHT(A3,LEN(A3)-FIND("~",SUBSTITUTE($A3," ","~",D$2)))
 
Upvote 0
This works like a charm thank you
I also get a few come through on my main sheet with no space
So they come through like below
Chl_Cpick 4Chl_Mar 6
How would I separate them
 
Upvote 0
I see the Space before Numbers, Is it correct?
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top