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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

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