How to extract text before or after a second hyphen(-) using formula

sayseee

New Member
Joined
Nov 25, 2021
Messages
22
Office Version
  1. 2019
Platform
  1. Windows
I have my data in column A and I want to separate the strings as seen in column HOME and AWAY.

DATAHOMEAWAY
Al-Faisaly - Al TaeeAl-FaisalyAl Taee
Al-Nassr - Al-ShababAl-Nassr Al-Shabab
Al-Shabab - Al-Ittihad FCAl-ShababAl-Ittihad FC
Al-Hazem - Al-ShababAl-HazemAl-Shabab
Al-Shabab - Al-FatehAl-ShababAl-Fateh


using normal LEFT formula
Excel Formula:
LEFT(A2,FIND("-",A2)-1)
in column B, I get as below and this is not what i need.
WettPoint.xlsm
ABC
1DATAHOMEAWAY
2Al-Faisaly - Al TaeeAlAl Taee
3Al-Nassr - Al-ShababAlAl-Shabab
4Al-Shabab - Al-Ittihad FCAlAl-Ittihad FC
5Al-Hazem - Al-ShababAlAl-Shabab
6Al-Shabab - Al-FatehAlAl-Fateh
Sheet3
Cell Formulas
RangeFormula
B2:B6B2=LEFT(A2,FIND("-",A2)-1)


How do I get through this?
Thank you
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi

Excel Formula:
=FILTERXML("<y><z>"&SUBSTITUTE(A2," - ","</z><z>")&"</z></y>","//z[position()=1]")
=FILTERXML("<y><z>"&SUBSTITUTE(A2," - ","</z><z>")&"</z></y>","//z[position()=2]")
 
Upvote 0
Upvote 0
You're welcome. Glad we could help. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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