EXCEL: Easy way to extract characters from a String?

wageslave101

Board Regular
Joined
Jul 18, 2007
Messages
154
Morning Guru's :D

I have a cell with a string, there are three letters that can appear at several places within the string.

For example;

280807GFX1900
GFX280807800
2808GFX2007T

I'm trying to write a check that returns TRUE/FALSE for the string containing GFX anywhere in it.

I've been working with MID, but that involves multiple checks of elimination, which led me to wonder if there's a way to check a string for the characters?

Thank you for your time,
WageSlave101
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
I found that I can use

=IF(ISERROR(FIND("GFX", B8, 1)), 0, 1)

Which returns a 0 if GFX does not exist anywhere in the string or 1 if it does appear anywhere in the string.

Does the job, but is the best way to do this?

WageSlave101
 
Upvote 0
Hi wageslave101

I'm trying to write a check that returns TRUE/FALSE for the string containing GFX anywhere in it.

In this case you don't need the if:

=ISNUMBER(FIND("GFX",B8))

Hope this helps
PGC

P. S. Find() is case sensitive. If you don't want that use Search() instead.
 
Upvote 0
hi WageSlave101,

If you wanted to find where, if at all, those characters are found, you could use:
=IF(ISERROR(FIND("GFX", B8)), 0, FIND("GFX", B8))
In this case, any non-zero number indicates the position of the first character in the string.

Cheers
 
Upvote 0
and if you want to return a 1 or 0 instead of TRUE/FALSE, as indicated in your formula:

=ISNUMBER(FIND("GFX",B8))+0
 
Upvote 0
Thank you very much for all the response :biggrin:

I love this board and all the wonderful folks that contribute, I hope that all that karma rewards you all... you all deserve it!

Thank you again,
Wageslave
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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