Search the charactor by space

sophea_tum

New Member
Joined
May 8, 2015
Messages
42
Hi,

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

DATA
adfd dfgfer cdd ffgggg
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 ffggggcdd
3​
aa sdd sdsdf dsdd
4​
dfs dfdf dfcddfs
5​

B2, copied down:
Rich (BB code):

=IF(ISNUMBER(SEARCH(" ??? "," "&A2&" ")),
   TRIM(MID(" "&A2&" ",SEARCH(" ??? "," "&A2&" "),LEN(" ??? "))),
   "not found")
 
Upvote 0
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 ffggggcdd
3​
aa sdd sdsdf dsdd
4​
dfs dfdf dfcddfs
5​

<tbody>
</tbody>


B2, copied down:
Rich (BB code):

=IF(ISNUMBER(SEARCH(" ??? "," "&A2&" ")),
   TRIM(MID(" "&A2&" ",SEARCH(" ??? "," "&A2&" "),LEN(" ??? "))),
   "not found")

HI,

Thanks, that is helpful.
 
Upvote 0
HI,

Thanks, that is helpful.

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&" "),
    LEN(" "&REPT("?",B$1)&" "))),"not found")

where B1 houses a value like 3.
 
Last edited:
Upvote 0

Forum statistics

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