![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 8
|
Hi everyone
First let me express my grattitude for everyone taking their time to answer questions on this board. At least personnally speakig, this board is extremely valuable. On to question: I know this must be a piece of cake for the experts. I wish to search for a substring within an array of strings and just return back an indication that the substring exists withing that array. so for instance let the substring be "rang" and let the array be {"apple","orange","lemon"}. I wish to put a single command line next to my substring and wish to search through that range and return a key code if it exists. And then I will repeat the same search for other substrings. For the moment being, I don't care too much about the number of occurences or the exact cell address where they occur. All I wish to know is whether they exist in that list or not. So it looks to me it is like a SEARCH command but except on a range of text (Rather than a single text) with an array formula. I have tried MATCH but my case is not an exact match either. Any help will be greatly appreciated. Thanks |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Have you tried using
=SEARCH("*rang*",A1,1) .... if your array is in cell A1 Regards!
__________________
Regards! Yogi Anand, D.Eng, P.E. Energy Efficient Building Network LLC www.energyefficientbuild.com |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Southfield,MI USA
Posts: 1,030
|
Hey,
This would give you a yes or no on whether or not "rang" appears anywhere in your text: Assuming range A1:A3 (containing "apple","orange", and "lemon" respectively). =IF(COUNTIF(A1:A3,"*rang*")>0,"yes","no") Adam |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Southfield,MI USA
Posts: 1,030
|
Heh, you were faster on the draw Yogi
Adam |
|
|
|
|
|
#5 |
|
New Member
Join Date: May 2002
Posts: 8
|
Yogi,
Thanks for your reply. No. The array is huge and is located at a range of cells (rather than a single cell). |
|
|
|
|
|
#6 |
|
New Member
Join Date: May 2002
Posts: 8
|
Asala,
Yours worked out perfectly, I knew this was easy. Thanks a lot guys. |
|
|
|
|
|
#7 |
|
New Member
Join Date: Apr 2008
Posts: 3
|
How would you go about having it return the value you were checking for in the cell instead of the CHECKIF statement's true/false. Preferably not with VBA macros, I know it's easier but you can't undo it as easily if you mess up.
|
|
|
|
|
|
#8 | |
|
MrExcel MVP
Join Date: Mar 2004
Location: Canada
Posts: 12,423
|
Quote:
=IF(ISNUMBER(MATCH("*"&C2&"*",$A$2:$A$10,0)),C2,"") Hope this helps! |
|
|
|
|
|
|
#9 |
|
New Member
Join Date: Apr 2008
Posts: 3
|
How about if I am looking for a range of numbers in that array.
For example: Array1: 10, 40, 63, 78, 112, 560 and I want the number that is between 75 and 100. How would I do this? Also, how does it react if there was an extra 90 in the array and there were potentially 2 numbers within the range? Thanks! |
|
|
|
|
|
#10 |
|
New Member
Join Date: Apr 2008
Posts: 3
|
Actually, I figured it out using a HLookup formula, thank you though Domenic because it took looking at your formula for me to figure out how to come up with the one that I needed!
BV206=HLOOKUP(150,AK206:BT206,1,TRUE) BW206=HLOOKUP(420,AK206:BT206,1,TRUE) BX206=IF(AND(BV206<=150,BV206>=61,BW206<=420,BW206>=300),"Viable","Non-Viable") (Cell Number=Formula) |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|