List Based On Matches

deZine

New Member
Joined
May 6, 2009
Messages
25
I am looking for a way to show a list within one cell based on matching criteria. I would prefer to accomplish this without VBA if possible.



If the name in column AH matches AI10 then include the number that is in column I in the list.

Cell AJ10 is the desired output.

Please let me know if my description is inadequate. Thanks in advance for your help!
 

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
We see requests for these from time to time. The problem is that excel cannot concatenate a range by formula (at least in versions 2003 and 2007). I know a simple UDF that will do this for you, though. Let me know if your no VBA preference is flexible.
 
Upvote 0
Thanks Sheetspread. If VBA is the only way to go then I am flexible. I am not sure if it matters, but the data does not start until row 516 and will go no further than 546. Thanks again for your help.
 
Upvote 0
Code:
Function ConcatIf(ByVal compareRange As Range, ByVal xCriteria As Variant, _ 
    Optional ByVal stringsRange As Range, Optional Delimiter As String) As String 
    Dim i As Long, j As Long, criteriaMet As Boolean 
     
    Set compareRange = Application.Intersect(compareRange, _ 
    compareRange.Parent.UsedRange) 
     
    If compareRange Is Nothing Then Exit Function 
    If stringsRange Is Nothing Then Set stringsRange = compareRange 
    Set stringsRange = compareRange.Offset(stringsRange.Row - compareRange.Row, _ 
    stringsRange.Column - compareRange.Column) 
     
    For i = 1 To compareRange.Rows.Count 
        For j = 1 To compareRange.Columns.Count 
            If (Application.CountIf(compareRange.Cells(i, j), xCriteria) = 1) Then 
                ConcatIf = ConcatIf & Delimiter & CStr(stringsRange.Cells(i, j)) 
            End If 
        Next j 
    Next i 
    ConcatIf = mid(ConcatIf, Len(Delimiter) + 1) 
End Function



Excel Workbook
IAHAIAJAK
5163John***
5174John***
5185Mike***
5196Steve***
5207Robert***
5218John***
5229Robert***
523*****
524*****
525*****
526*****
527*****
528*****
529*****
530*****
531*****
532*****
533*****
534*****
535*****
536*****
537*****
538*****
539*****
540*****
541*****
542*****
543*****
544*****
545*****
546*****
547**JohnNumber 3,4,8*
Sheet1



VBA genius Mike Rickson wrote the code
 
Last edited:
Upvote 0
Solution
Thank you very much for your help. I have to admit that I don't really understand the solution that you gave me. I have a very similar issue that I am trying to adapt your solution to. In this instance I need it to check two columns at the same time for matches.

This is what I tried without success:
="Number "&ConcatIf((AN516:AN546,AL516:AL546),B26,I516:I546,",")
 
Upvote 0
I'll keep trying, but modifying the code hasn't gotten me there yet. ConcatIf seems to be like sumif in being limited to one condition. There are multi-criteria concatenation macros on the web, those too require some adjustment for this array.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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