Link to home
Start Free TrialLog in
Avatar of angus_young_acdc
angus_young_acdcFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel Formula to Find Part of String

Hello,

I have a rather large list of files that I've put into Excel, and I'm trying to narrow it down to only ones that I require.  Can anybody help me write a formula that will look for specific parts of text within the cell, for example any file that contains .COMP, .XML, etc.

All help is appreciated.
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Any further info about potential structures of the candidate strings ... i.e.

=RIGHT(A1, LEN(A1) - FIND(".",A1))

Will return all text to the right of the first dot

Chris
Sorry didn't finish that

Will return all text to the right of the first dot ... but you may require last dot, text up to subsequent space or a number of other possibilities so representative data samples and required responses will help.

Chris

 
=find(".COMP",A1,1) where A1 is the cell with the info in.

or

=find(".XML",A1,1)
Avatar of angus_young_acdc

ASKER

Hey chris_bottomley and Wadski, unfortunately the strings will be of differing lengths so I won't be able to do a RIGHT or LEFT.  I shall try using find and get back to you both.
If you just want specific file extensions then try listing all of those in a cell range, e.g. D2:D10 [with the preceding dot, i.e. ".COMP" etc, then assuming you have file names in column A use this formula in B2 copied down to identify (as TRUE) the files you want
=ISNUMBER(LOOKUP(2^15,SEARCH(D$2:D$10,A2)))
regards, barry
A quick update, I've tried using a Find but that appears to bring back the starting point of the string.  

As requested I shall explain more, I have a list of over 400K files with various different extentions, mixed in with this are file names that I just don't need (their ext will be .XML, .COMP, .FIN)  So I'm hoping to have a formula that will look for these values, and allow me to easily remove them from the list.
See attached example of my suggestion. You can now filter by column B to see the data you want/ don't want
regards, barry

26607563.xls
ASKER CERTIFIED SOLUTION
Avatar of barry houdini
barry houdini
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you do a nested FIND statement with all three filetypes in it then sort by the column with the find statement you can then delete the rows with a number in them - leaving only the rows without these extensions.

you may also need to use the UPPER() statement if you are going to use the find statement to avoid lowercase filetypes being missed.

Thats fantastic thank you very much.  I had a bit of trouble getting this working though, I had to re-write the formula a few times (all exactly the same) before it would work.... I just put that down to bad luck.

Thanks again!