Page 1 of 1

combine 2columns

Posted: Sat Oct 08, 2022 4:44 pm
by sna
Hi Dear

I need your help how to check item between lista and listb then combine into a column for matching items.

I attached a
tks

Re: combine 2columns

Posted: Sat Oct 08, 2022 5:57 pm
by snasui
:D In cell C2 enter this formula,

=IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW($B$2:$B$10)/ISNUMBER(MATCH($B$2:$B$10,$A$2:$A$7,0)),ROWS(C$2:C2))),"")

Enter and copy down.

Re: combine 2columns

Posted: Sat Oct 08, 2022 7:10 pm
by sna
Thank you 😊

Re: combine 2columns

Posted: Sun Oct 09, 2022 3:39 pm
by sna

Code: Select all

Sub test()
Dim i As Long,Lr As Long 
Dim rng As Range,C As Range 
Dim r
Lr= Sheet1.Range("O" & Rows.Count).End(xlUp).Row 
Set rng=Sheet1.Range("O2:O"&Lr)
For Each C in rng.Cells
Set r= Sheet1.Range("U:U").Find(What:=C.Value,Lookin:=xlValues,Look at:=xlWhole)
If Not r is Nothing Then
Range("W" & Rows.Count).End(xlUp).Offset(1).Value = Cells(r.Row,"U")
End If 
Next 
End Sub

Re: combine 2columns

Posted: Sun Oct 09, 2022 3:40 pm
by sna
Hi Dear
the formula working but I come up with new idea to write code

Re: combine 2columns

Posted: Mon Oct 10, 2022 6:39 am
by snasui
:D Please attach code in the example file and explain what the problem is.

Re: combine 2columns

Posted: Mon Oct 10, 2022 7:26 pm
by sna
Hi Dear,
the code above is aimed to populate data like the formula you gave but no luck.what's wrong?

Re: combine 2columns

Posted: Mon Oct 10, 2022 9:40 pm
by snasui
:D I don't find any error in that code.

Re: combine 2columns

Posted: Tue Oct 11, 2022 9:05 am
by sna
thanks,I will look at it again,may it coz of sheet name