Solved

excel array formula to create list from another list with wildcard text criteria

Posted on 2013-02-06
3
308 Views
Last Modified: 2013-02-12
I have a row of text values.
Some of these text values end in "95"
I'm trying to build an array formula that will create another list with only those that end in "95.

What I am trying is not working

=INDEX($A$1:$Z$1,0,MATCH("*95",$A$1:$Z$1,0))

any ideas?
0
Comment
Question by:newparadigmz
  • 2
3 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 38862084
INDEX/MATCH should work to get the first match (or you can use HLOOKUP with a wildcard too) but you need something more complex to get multiple matches......

If your list is in A1:Z1 then to build another horizontal list of only those values try this formula in A3 confirmed with CTRL+SHIFT+ENTER and copied across

=IFERROR(INDEX($A$1:$Z$1,SMALL(IF(RIGHT($A$1:$Z$1,2)="95",COLUMN($A$1:$Z$1)-COLUMN($A$1)+1),COLUMNS($A3:A3))),"")

If you want a vertical list then replace COLUMNS function at the end with ROWS and drag down like:

=IFERROR(INDEX($A$1:$Z$1,SMALL(IF(RIGHT($A$1:$Z$1,2)="95",COLUMN($A$1:$Z$1)-COLUMN($A$1)+1),ROWS(A$3:A3))),"")

see attached example

regards, barry
multi-lookup.xlsx
0
 

Author Comment

by:newparadigmz
ID: 38865267
Thanks, this works, but is there a way where you dont need to reference the cell the formula is in?

I'd like to be able to put it anywhere and not have to change that reference or use the relative referencing, COLUMNS($A3:A3).

Also, can you explain a little? I don't get why you need small.
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 500 total points
ID: 38865570
If you want you can use just COLUMN(A1) like

=IFERROR(INDEX($A$1:$Z$1,SMALL(IF(RIGHT($A$1:$Z$1,2)="95",COLUMN($A$1:$Z$1)-COLUMN($A$1)+1),COLUMN(A1))),"")

That should work OK wherever you put it, as long as you are copying across

It doesn't really matter as long as it increments - I use the cell reference of the start cell because it's a little more robust - if you use COLUMN(A1) when starting at E5 that will work but if you now delete column A the A1 reference turns into a #REF! error.

This part of the formula

IF(RIGHT($A$1:$Z$1,2)="95",COLUMN($A$1:$Z$1)-COLUMN($A$1)+1)

returns an array of either FALSE values or the column number of a value ending with 95, i.e. for my example that will return this array

{1,FALSE,FALSE,4,FALSE,FALSE,FALSE,FALSE,9,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE}

where 1, 4 and 9 represent the columns where the data ends with 95

and SMALL in conjunction with the COLUMNS function will take the smallest number in the first formula, 2nd smallest in the next, 3rd smallest in the next etc. .....and then INDEX gives you the relevant value from that numbered cell in the range

regards, barry
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now