Finding any occourrence of a character in a string

Anthony47

Well-known Member
Joined
Mar 29, 2006
Messages
3,823
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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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