Find the first character in a cell

Mindpsyche

Well-known Member
Joined
Mar 19, 2012
Messages
760
Hello,

If I have a cell which begins with a few spaces and then has a character, how do I use the find function to see how many spaces until some character is present in the cell. The * does not work with this.

Excel 2007
B
4 a

<colgroup><col style="width: 25pxpx"><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Not sure if this is what you want, but you can try, the following which works without using the FIND function:
Code:
=LEN(A1)-TRIM(LEN(A1))
This will count the number of spaces at the start until a non-space character is reached
 
Upvote 0
Hello,

If I have a cell which begins with a few spaces and then has a character, how do I use the find function to see how many spaces until some character is present in the cell. The * does not work with this.

Excel 2007
B
4 a

<tbody>
</tbody>
Sheet1

=FIND(LEFT(TRIM(B2),1),B2)

returns the position of the non-space char.

=FIND(LEFT(TRIM(B2),1),B2)-1

gives the number of spaces to the first non-space char.
 
Upvote 0
Not sure if this is what you want, but you can try, the following which works without using the FIND function:
Code:
=LEN(A1)-TRIM(LEN(A1))
This will count the number of spaces at the start until a non-space character is reached

Trailing and extraneous in-between spaces would thwart this formula completely.
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,608
Members
449,038
Latest member
apwr

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