Extract text between characters

zinah

Active Member
Joined
Nov 28, 2018
Messages
358
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have below sample table that I'm trying to extract the text between the two hyphens in Chain 2, and text after the 2nd hyphen in Chain 3. Can anyone help with formulas?

Extract Text Formula.xlsx
ABCDEFGH
1Exptected Results
2Dimension valueChain 01Chain 02Chain 03Chain 01Chain 02Chain 03
3John AJohn A  John A
4John A-Jame OJohn AJame O John AJame O
5John A-Jame O-Maggie BJohn AJame O-Maggie BMaggie BJohn AMaggie BMaggie B
6John A-Jame O-Susan NJohn AJame O-Susan NSusan NJohn ASusan NSusan N
7John A-Jame O-Simon BJohn AJame O-Simon BSimon BJohn ASimon BSimon B
8John A-Jame O-James DJohn AJame O-James DJames DJohn AJames DJames D
9John A-Jame O-Anne WJohn AJame O-Anne WAnne WJohn AAnne WAnne W
10John A-Jame O-Kevin MJohn AJame O-Kevin MKevin MJohn AKevin MKevin M
11John A-John A-Mary OJohn AJohn A-Mary OMary OJohn AMary OMary O
12John A-John A-Olivia AJohn AJohn A-Olivia AOlivia AJohn AOlivia AOlivia A
13John A-Perry OJohn APerry O John APerry O
14John A-Perry O-Will BJohn APerry O-Will BWill BJohn APerry OWill B
15John A-Teddy RJohn ATeddy R John ATeddy R
Sheet1
Cell Formulas
RangeFormula
B3:B15B3=IFNA(TEXTBEFORE(A3,"-"),A3)
C3:C15C3=IFNA(TEXTAFTER(A3,"-",1),"")
D3:D15D3=IFNA(TEXTAFTER(A3,"-",2),"")
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Delete whatever you have in cells B3, C3, D3 on down and try this formula in cell B3 copied down (it will fill across Columns B, C and D automatically)...

=TEXTSPLIT(A3,"-")
 
Upvote 1
Solution
Delete whatever you have in cells B3, C3, D3 on down and try this formula in cell B3 copied down (it will fill across Columns B, C and D automatically)...

=TEXTSPLIT(A3,"-")
Thank you so much for this formula!, it worked perfectly great!
 
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,646
Members
449,462
Latest member
Chislobog

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