Extract A String Between Two Characters

theaudioguy

New Member
Joined
Jan 27, 2010
Messages
27
I'm stuck. I need a formula to extract data from between two characters.

For Example, In A1 I have this: COMP_PROG_v1_ABCD_01

I want to extract the value between the 3rd and 4th "_"'s. The number of "_"'s will be consistent but not the # of characters between them. My brain is tired of thinking. Thanks.
 
Hi, Could you please help with a formula to extract "P4/*" from the following examples:

Data --------------------------------------- Output
P4/3H6, ----------------------------------- P4/3H6
G6/3H4,GEN/18A12,P4/3H4, ------------ P4/3H4
P4/2C1.1,SLD/DIST, --------------------- P4/2C1.1
CEN/REVMET,P4/2C8, ------------------- P4/2C8
G8/3H3,L9/3H3,P4/3H3,R111/3H3, ---- P4/3H3
P4/3H15, --------------------------------- P4/3H15

The string I want to extract will always have a "," at the end.

Thanks in advance.
 
Last edited:
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi, Could you please help with a formula to extract "P4/*" from the following examples:

Data --------------------------------------- Output
P4/3H6, ----------------------------------- P4/3H6
G6/3H4,GEN/18A12,P4/3H4, ------------ P4/3H4
P4/2C1.1,SLD/DIST, --------------------- P4/2C1.1
CEN/REVMET,P4/2C8, ------------------- P4/2C8
G8/3H3,L9/3H3,P4/3H3,R111/3H3, ---- P4/3H3
P4/3H15, --------------------------------- P4/3H15

The string I want to extract will always have a "," at the end.

Thanks in advance.

Try this for the desired output: =LEFT(MID(D5,FIND("P4",A2),LEN(A2)),FIND("|",SUBSTITUTE(MID(A2,FIND("P4",A2),LEN(A2)),",","|",1))-1)

Note: The data should be start from A1
 
Upvote 0
Hi,

Can anyone help me with the following,

A1. 50-1HO-34068-3CS15-H37
A2. 25-1FG-22254-1CS11-N
A3. 500-0FW+33347-12CS21-N
A4. 50-0OW-11105-1CS23-PP25
........
........

I want to extract the following data from column A to column B

B1. 3CS15
B2. 1CS11
B3. 12CS21
B4. 1CS23
......
......

Thanks in advance
 
Upvote 0
I am trying to extract all text between two # and the length will vary. I have tried the formulas above and just can't get it to work.

Can anyone suggest a formula?
Thanks
 
Upvote 0
I am trying to extract all text between two # and the length will vary. I have tried the formulas above and just can't get it to work.
Will the two # signs you want the text between be the only # signs in the text?
 
Upvote 0
Give this formula a try...

=MID(A1,1+FIND("#",A1),FIND("#",A1,FIND("#",A1)+1)-FIND("#",A1)-1)

or this one...

=TRIM(MID(SUBSTITUTE(A1,"#",REPT(" ",200)),200,200))

your choice.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,346
Members
452,638
Latest member
Oluwabukunmi

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