# Search the charactor by space

#### sophea_tum

##### New Member
Hi,

i am working on the short data and i get stuck on sth like the following example.

DATA
aa sdd sdsdf d
dfs dfdf dfcd

I have to search cell by cell of the criteria (" yyy " we spell "space + 1st character + 2nd character + 3rd characte + space")
so how can i find the position space (search function) of " yyy " where "y" is the variable single character.

thanks!

### Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Nothing said about what to return when successful...

A pattern like " yyy " as you symbolize it, can be rendered as " ??? " in Excel, where ? stands for a single alphabetic token (length = 1).

 Row\Col A​ B​ 1​ 2​ adfd dfgfer cdd ffgggg cdd 3​ aa sdd sdsdf d sdd 4​ dfs dfdf dfcd dfs 5​

B2, copied down:
Rich (BB code):
``````
=IF(ISNUMBER(SEARCH(" ??? "," "&A2&" ")),
TRIM(MID(" "&A2&" ",SEARCH(" ??? "," "&A2&" "),LEN(" ??? "))),
``````

Nothing said about what to return when successful...

A pattern like " yyy " as you symbolize it, can be rendered as " ??? " in Excel, where ? stands for a single alphabetic token (length = 1).

 Row\Col A​ B​ 1​ 2​ adfd dfgfer cdd ffgggg cdd 3​ aa sdd sdsdf d sdd 4​ dfs dfdf dfcd dfs 5​

<tbody>
</tbody>

B2, copied down:
Rich (BB code):
``````
=IF(ISNUMBER(SEARCH(" ??? "," "&A2&" ")),
TRIM(MID(" "&A2&" ",SEARCH(" ??? "," "&A2&" "),LEN(" ??? "))),
``````

HI,

HI,

You are welcome.

If you want flexibility...
Rich (BB code):
``````
=IF(ISNUMBER(SEARCH(" "&REPT("?",B\$1)&" "," "&A2&" ")),
TRIM(MID(" "&A2&" ",SEARCH(" "&REPT("?",B\$1)&" "," "&A2&" "),
``````

where B1 houses a value like 3.

Last edited:

Replies
16
Views
539
Replies
4
Views
523
Replies
2
Views
272
Replies
6
Views
6K
Replies
7
Views
679

1,203,069
Messages
6,053,347
Members
444,654
Latest member
Rich Cohen

### 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.

### Which adblocker are you using?

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

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