Finding any occourrence of a character in a string

Anthony47

Well-known Member
Joined
Mar 29, 2006
Messages
3,822
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi everybody,
in a string like "Dear friends please I need your help" how can I get the position of the first, the second, the third and so on position of a specific character, for example the "space"?
Now I do that via Udf, but I should do the job without using vba, if possible.

Thanks for your help.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi

Assuming the string in A1, in B1:

=FIND("#",SUBSTITUTE($A1," ","#",COLUMNS($B1:B1)))

Copy to the right. It will give you the positions of the spaces in the string.
 
Upvote 0
Many thanks to both of you for your answers.
pgc01's formula does perfectly the job, ie the possibility of finding not only the first occourrence of the character but also the second, third and so on.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,808
Messages
6,121,686
Members
449,048
Latest member
81jamesacct

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