Extract the last text and mark (/)

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all.....

how to extract this below text (delete last string) :

like sample :

[TABLE="width: 573"]
<tbody>[TR]
[TD]SAMPLE[/TD]
[TD]AFTER FORMULA[/TD]
[/TR]
[TR]
[TD]JL.HANG LEKIU NO 29 SUKAMULIA SAIL[/TD]
[TD]JL.HANG LEKIU NO 29 SUKAMULIA[/TD]
[/TR]
[TR]
[TD]JL.SAOMATI RT 03/07, SAIL/TENAYAN RAYA[/TD]
[TD]JL.SAOMATI RT 03/07, SAIL[/TD]
[/TR]
[TR]
[TD]JL.BELANAK IV/452 LIMBUNGAN RUMBAI PESISIR[/TD]
[TD]JL.BELANAK IV/452 LIMBUNGAN[/TD]
[/TR]
[TR]
[TD]JL.KIJANG NO 24 HARJOSARI/SUKAJADI[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]JL.HANG TUAH KP. KELAPA NO 38 SAIL[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JL.KEMUNING GG MESJID NO 30A SENAPELAN[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JL.PINUS GG.SUNGKAI NO 1 TANGKERANG UTARA[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

any assistance, much appreciated..

m.susanto
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
you need to define rules ie the first example SAIL is deleted
so it could be delete last word
but example 2 the last 2 words and a preceding "/" are deleted and SAIL remains ????

we need RULES
 
Upvote 0
Maybe......

=LEFT(A2,LOOKUP(1,-MID(A2,ROW($1:$99),1),ROW($1:$99))-1)&TRIM(LEFT(SUBSTITUTE(MID(SUBSTITUTE(A2,"/"," "),LOOKUP(1,-MID(A2,ROW($1:$99),1),ROW($1:$99)),250)," ",REPT(" ",50)),99))
 
Last edited:
Upvote 0
Maybe......

=LEFT(A2,LOOKUP(1,-MID(A2,ROW($1:$99),1),ROW($1:$99))-1)&TRIM(LEFT(SUBSTITUTE(MID(SUBSTITUTE(A2,"/"," "),LOOKUP(1,-MID(A2,ROW($1:$99),1),ROW($1:$99)),250)," ",REPT(" ",50)),99))

hi bosco, thank works great!!!

i just delete "/(last text)" like my clue in red font, i think it's clear...
 
Upvote 0
i have new problem :
JL.IKAN RAYA MUARA FAJAR RUMBAI --------JL.IKAN RAYA MUARA FAJAR RUMBAI (not change-should be)
JL.HANGTUAH GG.SUKMA-------------------JL.HANGTUAH GG.SUKMA (not change-should be)
JL.SAMAN HUDI SAGO/SENAPELAN ---------JL.SAMAN HUDI SAGO

note : /SENAPELAN -- should be delete

there are more shorter formula?
 
Upvote 0
i have new problem :
JL.IKAN RAYA MUARA FAJAR RUMBAI --------JL.IKAN RAYA MUARA FAJAR RUMBAI (not change-should be)
JL.HANGTUAH GG.SUKMA-------------------JL.HANGTUAH GG.SUKMA (not change-should be)
JL.SAMAN HUDI SAGO/SENAPELAN ---------JL.SAMAN HUDI SAGO

note : /SENAPELAN -- should be delete

there are more shorter formula?

Try,

=LEFT(A1,FIND("/",A1&"/")-1)
 
Upvote 0
Try,

=LEFT(A1,FIND("/",A1&"/")-1)

hi bosco, not fully work...

[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH="align: left"]JL.HANG LEKIU NO 29 SUKAMULIA SAIL[/TH]
[TH]JL.HANG LEKIU NO 29 SUKAMULIA SAIL[/TH]
[/TR]
[TR]
[TD]JL.HANGTUAH GG.SUKMA[/TD]
[TD]JL.HANGTUAH GG.SUKMA[/TD]
[/TR]
[TR]
[TD]JL.IKAN RAYA MUARA FAJAR RUMBAI[/TD]
[TD]JL.IKAN RAYA MUARA FAJAR RUMBAI[/TD]
[/TR]
[TR]
[TD]JL.SAOMATI RT 03/07, SAIL/TENAYAN RAYA[/TD]
[TD]JL.SAOMATI RT 03/07, SAIL[/TD]
[/TR]
[TR]
[TD]JL.ABDUL MUIS NO.32 CINTARAJA/SAIL[/TD]
[TD]JL.ABDUL MUIS NO.32 CINTARAJA[/TD]
[/TR]
[TR]
[TD]JL.KUANTAN II GG.PALUH NO 3C SEKIP/LIMA PULUH[/TD]
[TD]JL.KUANTAN II GG.PALUH NO 3C SEKIP[/TD]
[/TR]
</tbody>[/TABLE]

for text Bold, the data is should be not deleted after use formula otherwise "/(text)" is deleted
 
Last edited:
Upvote 0
hi bosco, not fully work...

[TABLE="class: tableizer-table"]
<tbody>[TR="class: tableizer-firstrow"]
[TH="align: left"]JL.HANG LEKIU NO 29 SUKAMULIA SAIL[/TH]
[TH]JL.HANG LEKIU NO 29 SUKAMULIA SAIL[/TH]
[/TR]
[TR]
[TD]JL.HANGTUAH GG.SUKMA[/TD]
[TD]JL.HANGTUAH GG.SUKMA[/TD]
[/TR]
[TR]
[TD]JL.IKAN RAYA MUARA FAJAR RUMBAI[/TD]
[TD]JL.IKAN RAYA MUARA FAJAR RUMBAI[/TD]
[/TR]
[TR]
[TD]JL.SAOMATI RT 03/07, SAIL/TENAYAN RAYA[/TD]
[TD]JL.SAOMATI RT 03/07, SAIL[/TD]
[/TR]
[TR]
[TD]JL.ABDUL MUIS NO.32 CINTARAJA/SAIL[/TD]
[TD]JL.ABDUL MUIS NO.32 CINTARAJA[/TD]
[/TR]
[TR]
[TD]JL.KUANTAN II GG.PALUH NO 3C SEKIP/LIMA PULUH[/TD]
[TD]JL.KUANTAN II GG.PALUH NO 3C SEKIP[/TD]
[/TR]
</tbody>[/TABLE]

for text Bold, the data is should be not deleted after use formula otherwise "/(text)" is deleted

Try,

=IFERROR(LEFT(A1,LOOKUP(99,FIND("/",A1,ROW($1:$99)))-1),A1)
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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