Help with textfunction

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
HI guys,

I am struggling to get the function to work to find me the position of the 4th last space within a string from the right.

String is like.. "Firstname Secondname Surname Myhome 23 8545 Westfield"
but it also could be like "Firstname Surname Myhome 5 4524 Testinghof"

Now I like to get rid of the adresses within the string..

So basically the result need to be like: "Firstname Secondname Surname"
or " Firstname Surname"

I was thinking of finding the 4th last space within the string. Tried with Find and substitute but as the name or better the empty spaces can vary I was out of luck getting it to work.

Could someone give me a hand with this please?

many thanks

Albert
 
Last edited:
Another option would be to change this line from post #2

Code:
Ary = Split(Cl & "    ", " ") ' append four spaces
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,215,267
Messages
6,123,964
Members
449,137
Latest member
yeti1016

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