If function now working

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,134
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
HI All,

Below is the data and the disire out is not working as required, any suggestions.

Book2
ABC
2NameFormulaActual Result
3PE-Agg22-Mur-101-7-HundredGigE0/2/0/1PE-Agg22-Mur-101-7PE-Agg22-Mur-101-7
4PE-L3Agg-Abar-422-2-TenGigabitEthernet8/4PE-L3Agg-Abar-422-PE-L3Agg-Abar-422-2
5PE-L3Agg-Abar-422-2-TenGigabitEthernet9/4PE-L3Agg-Abar-422-PE-L3Agg-Abar-422-2
6PRE-AGG9K-701-11-000-1-TenGigE0/0/0/0PRE-AGG9K-701-11-000PRE-AGG9K-701-11-000-1
7PRE-AGG9K-701-11-000-1-TenGigE0/0/0/2PRE-AGG9K-701-11-000PRE-AGG9K-701-11-000-1
8PRE-AGG9K-701-11-000-1-TenGigE0/0/1/0PRE-AGG9K-701-11-000PRE-AGG9K-701-11-000-1
9PRE-AGG9K-701-11-000-1-TenGigE0/0/2/0PRE-AGG9K-701-11-000PRE-AGG9K-701-11-000-1
10PRE-AGG9K-DREARDBH-2-TenGigE0/1/0/0PRE-AGG9K-DREARDBH-2PRE-AGG9K-DREARDBH-2
11PRE-AGG9K-707-41-000-1-TenGigE0/0/2/0PRE-AGG9K-707-41-000PRE-AGG9K-707-41-000-1
12PRE-AGG9K-713-31-000-1-TenGigE0/0/2/0PRE-AGG9K-713-31-000PRE-AGG9K-713-31-000-1
13PRE-AGG9K-714-00-000-1-TenGigE0/0/2/0PRE-AGG9K-714-00-000PRE-AGG9K-714-00-000-1
14PRE-AGG9K-717-00-000-1-TenGigE0/0/2/0PRE-AGG9K-717-00-000PRE-AGG9K-717-00-000-1
15PRE-AGG9K-FAM10-1-TenGigE0/0/2/0PRE-AGG9K-FAM10-1-TePRE-AGG9K-FAM10-1
16RTPE1-Jiz2-703-41-3-TenGigE0/0/0/0RTPE1-Jiz2-703-41RTPE1-Jiz2-703-41-3
17RTPE1-Jiz2-703-41-4-TenGigE0/2/0/0RTPE1-Jiz2-703-41RTPE1-Jiz2-703-41-4
Sheet1
Cell Formulas
RangeFormula
B3:B17B3=LEFT(A3,FIND("-",A3)+FIND("-",MID(A3,FIND("-",A3)+1,LEN(A3)))+FIND("-",MID(A3,FIND("-",MID(A3,FIND("-",A3)+1,LEN(A3)))+1,LEN(A3)))+FIND("-",MID(A3,FIND("-",MID(A3,FIND("-",MID(A3,FIND("-",A3)+1,LEN(A3)))+1,LEN(A3)))+1,LEN(A3))))
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try this

Book1
ABC
2NameFormulaActual Result
3PE-Agg22-Mur-101-7-HundredGigE0/2/0/1PE-Agg22-Mur-101-7PE-Agg22-Mur-101-7
4PE-L3Agg-Abar-422-2-TenGigabitEthernet8/4PE-L3Agg-Abar-422-2PE-L3Agg-Abar-422-2
5PE-L3Agg-Abar-422-2-TenGigabitEthernet9/4PE-L3Agg-Abar-422-2PE-L3Agg-Abar-422-2
6PRE-AGG9K-701-11-000-1-TenGigE0/0/0/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
7PRE-AGG9K-701-11-000-1-TenGigE0/0/0/2PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
8PRE-AGG9K-701-11-000-1-TenGigE0/0/1/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
9PRE-AGG9K-701-11-000-1-TenGigE0/0/2/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
10PRE-AGG9K-DREARDBH-2-TenGigE0/1/0/0PRE-AGG9K-DREARDBH-2PRE-AGG9K-DREARDBH-2
11PRE-AGG9K-707-41-000-1-TenGigE0/0/2/0PRE-AGG9K-707-41-000-1PRE-AGG9K-707-41-000-1
12PRE-AGG9K-713-31-000-1-TenGigE0/0/2/0PRE-AGG9K-713-31-000-1PRE-AGG9K-713-31-000-1
13PRE-AGG9K-714-00-000-1-TenGigE0/0/2/0PRE-AGG9K-714-00-000-1PRE-AGG9K-714-00-000-1
14PRE-AGG9K-717-00-000-1-TenGigE0/0/2/0PRE-AGG9K-717-00-000-1PRE-AGG9K-717-00-000-1
15PRE-AGG9K-FAM10-1-TenGigE0/0/2/0PRE-AGG9K-FAM10-1PRE-AGG9K-FAM10-1
16RTPE1-Jiz2-703-41-3-TenGigE0/0/0/0RTPE1-Jiz2-703-41-3RTPE1-Jiz2-703-41-3
17RTPE1-Jiz2-703-41-4-TenGigE0/2/0/0RTPE1-Jiz2-703-41-4RTPE1-Jiz2-703-41-4
Sheet1
Cell Formulas
RangeFormula
B3:B17B3=REPLACE(A3,FIND("|",SUBSTITUTE(A3,"-","|",LEN(A3)-LEN(SUBSTITUTE(A3,"-","")))),LEN(A3),"")
 
Upvote 0
Solution
Office 365 formula:
=TEXTBEFORE(A2,"-",-1)

Older Versions:
=TRIM(LEFT(SUBSTITUTE(A2,"-",REPT(" ",500),LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))),500))

Book1
ABC
1NameOffice 365 formulaOlder Versions
2PE-Agg22-Mur-101-7-HundredGigE0/2/0/1PE-Agg22-Mur-101-7PE-Agg22-Mur-101-7
3PE-L3Agg-Abar-422-2-TenGigabitEthernet8/4PE-L3Agg-Abar-422-2PE-L3Agg-Abar-422-2
4PE-L3Agg-Abar-422-2-TenGigabitEthernet9/4PE-L3Agg-Abar-422-2PE-L3Agg-Abar-422-2
5PRE-AGG9K-701-11-000-1-TenGigE0/0/0/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
6PRE-AGG9K-701-11-000-1-TenGigE0/0/0/2PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
7PRE-AGG9K-701-11-000-1-TenGigE0/0/1/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
8PRE-AGG9K-701-11-000-1-TenGigE0/0/2/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
9PRE-AGG9K-DREARDBH-2-TenGigE0/1/0/0PRE-AGG9K-DREARDBH-2PRE-AGG9K-DREARDBH-2
10PRE-AGG9K-707-41-000-1-TenGigE0/0/2/0PRE-AGG9K-707-41-000-1PRE-AGG9K-707-41-000-1
11PRE-AGG9K-713-31-000-1-TenGigE0/0/2/0PRE-AGG9K-713-31-000-1PRE-AGG9K-713-31-000-1
12PRE-AGG9K-714-00-000-1-TenGigE0/0/2/0PRE-AGG9K-714-00-000-1PRE-AGG9K-714-00-000-1
13PRE-AGG9K-717-00-000-1-TenGigE0/0/2/0PRE-AGG9K-717-00-000-1PRE-AGG9K-717-00-000-1
14PRE-AGG9K-FAM10-1-TenGigE0/0/2/0PRE-AGG9K-FAM10-1PRE-AGG9K-FAM10-1
15RTPE1-Jiz2-703-41-3-TenGigE0/0/0/0RTPE1-Jiz2-703-41-3RTPE1-Jiz2-703-41-3
16RTPE1-Jiz2-703-41-4-TenGigE0/2/0/0RTPE1-Jiz2-703-41-4RTPE1-Jiz2-703-41-4
Sheet1
Cell Formulas
RangeFormula
B2:B16B2=TEXTBEFORE(A2,"-",-1)
C2:C16C2=TRIM(LEFT(SUBSTITUTE(A2,"-",REPT(" ",500),LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))),500))
 
Upvote 0
Try this

Book1
ABC
2NameFormulaActual Result
3PE-Agg22-Mur-101-7-HundredGigE0/2/0/1PE-Agg22-Mur-101-7PE-Agg22-Mur-101-7
4PE-L3Agg-Abar-422-2-TenGigabitEthernet8/4PE-L3Agg-Abar-422-2PE-L3Agg-Abar-422-2
5PE-L3Agg-Abar-422-2-TenGigabitEthernet9/4PE-L3Agg-Abar-422-2PE-L3Agg-Abar-422-2
6PRE-AGG9K-701-11-000-1-TenGigE0/0/0/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
7PRE-AGG9K-701-11-000-1-TenGigE0/0/0/2PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
8PRE-AGG9K-701-11-000-1-TenGigE0/0/1/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
9PRE-AGG9K-701-11-000-1-TenGigE0/0/2/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
10PRE-AGG9K-DREARDBH-2-TenGigE0/1/0/0PRE-AGG9K-DREARDBH-2PRE-AGG9K-DREARDBH-2
11PRE-AGG9K-707-41-000-1-TenGigE0/0/2/0PRE-AGG9K-707-41-000-1PRE-AGG9K-707-41-000-1
12PRE-AGG9K-713-31-000-1-TenGigE0/0/2/0PRE-AGG9K-713-31-000-1PRE-AGG9K-713-31-000-1
13PRE-AGG9K-714-00-000-1-TenGigE0/0/2/0PRE-AGG9K-714-00-000-1PRE-AGG9K-714-00-000-1
14PRE-AGG9K-717-00-000-1-TenGigE0/0/2/0PRE-AGG9K-717-00-000-1PRE-AGG9K-717-00-000-1
15PRE-AGG9K-FAM10-1-TenGigE0/0/2/0PRE-AGG9K-FAM10-1PRE-AGG9K-FAM10-1
16RTPE1-Jiz2-703-41-3-TenGigE0/0/0/0RTPE1-Jiz2-703-41-3RTPE1-Jiz2-703-41-3
17RTPE1-Jiz2-703-41-4-TenGigE0/2/0/0RTPE1-Jiz2-703-41-4RTPE1-Jiz2-703-41-4
Sheet1
Cell Formulas
RangeFormula
B3:B17B3=REPLACE(A3,FIND("|",SUBSTITUTE(A3,"-","|",LEN(A3)-LEN(SUBSTITUTE(A3,"-","")))),LEN(A3),"")
this wokred perfect
 
Upvote 0
Office 365 formula:
=TEXTBEFORE(A2,"-",-1)

Older Versions:
=TRIM(LEFT(SUBSTITUTE(A2,"-",REPT(" ",500),LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))),500))

Book1
ABC
1NameOffice 365 formulaOlder Versions
2PE-Agg22-Mur-101-7-HundredGigE0/2/0/1PE-Agg22-Mur-101-7PE-Agg22-Mur-101-7
3PE-L3Agg-Abar-422-2-TenGigabitEthernet8/4PE-L3Agg-Abar-422-2PE-L3Agg-Abar-422-2
4PE-L3Agg-Abar-422-2-TenGigabitEthernet9/4PE-L3Agg-Abar-422-2PE-L3Agg-Abar-422-2
5PRE-AGG9K-701-11-000-1-TenGigE0/0/0/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
6PRE-AGG9K-701-11-000-1-TenGigE0/0/0/2PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
7PRE-AGG9K-701-11-000-1-TenGigE0/0/1/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
8PRE-AGG9K-701-11-000-1-TenGigE0/0/2/0PRE-AGG9K-701-11-000-1PRE-AGG9K-701-11-000-1
9PRE-AGG9K-DREARDBH-2-TenGigE0/1/0/0PRE-AGG9K-DREARDBH-2PRE-AGG9K-DREARDBH-2
10PRE-AGG9K-707-41-000-1-TenGigE0/0/2/0PRE-AGG9K-707-41-000-1PRE-AGG9K-707-41-000-1
11PRE-AGG9K-713-31-000-1-TenGigE0/0/2/0PRE-AGG9K-713-31-000-1PRE-AGG9K-713-31-000-1
12PRE-AGG9K-714-00-000-1-TenGigE0/0/2/0PRE-AGG9K-714-00-000-1PRE-AGG9K-714-00-000-1
13PRE-AGG9K-717-00-000-1-TenGigE0/0/2/0PRE-AGG9K-717-00-000-1PRE-AGG9K-717-00-000-1
14PRE-AGG9K-FAM10-1-TenGigE0/0/2/0PRE-AGG9K-FAM10-1PRE-AGG9K-FAM10-1
15RTPE1-Jiz2-703-41-3-TenGigE0/0/0/0RTPE1-Jiz2-703-41-3RTPE1-Jiz2-703-41-3
16RTPE1-Jiz2-703-41-4-TenGigE0/2/0/0RTPE1-Jiz2-703-41-4RTPE1-Jiz2-703-41-4
Sheet1
Cell Formulas
RangeFormula
B2:B16B2=TEXTBEFORE(A2,"-",-1)
C2:C16C2=TRIM(LEFT(SUBSTITUTE(A2,"-",REPT(" ",500),LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))),500))
this is also perfect, thanks a ton.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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