Read data from 1 column and relate to data in SAME column

jex57

Board Regular
Joined
Oct 29, 2015
Messages
62
Hi All,
Is there a way to read data in Column A, match it to other data in Column A and return all the values in Column B where the data is matched:
1587361138048.png



For example, in column A I have acquirer appearing with mas_stgmastercardtransactionacquirer_dly AND mas_stgmastercardtransactionissuer_dly, what I need to see is Column C with mas_stgmastercardtransactionacquirer_dly and Column D with mas_stgmastercardtransactionissuer_dly etc - so if there with 5 matches, it would go to column E, F and G as well.
Is there anyway to do this?

Thankyou
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Are you looking for the results to be produced into a new tab?

Are you looking for the results to be populated into the columns C-n on the same tab, removing the rows with duplicates in Column A?

Are you looking for the results to be populated into the columns C-n on the same tab, keeping the rows with duplicates in Column A?

Are you looking for a formula only solution, or is VBA OK?
 
Upvote 0
Are you looking for the results to be produced into a new tab?

Are you looking for the results to be populated into the columns C-n on the same tab, removing the rows with duplicates in Column A?

Are you looking for the results to be populated into the columns C-n on the same tab, keeping the rows with duplicates in Column A?

Are you looking for a formula only solution, or is VBA OK?

Thank you
A) results to be in new tab

Population should be something like this
1587381771547.png


Am looking for the VBA - dont think a formula can work

Thank you
 
Upvote 0
OK, this should do the trick.

Assumptions:
Source data is on "Sheet1", results will go on "Sheet2"
Source list has no headers, row 1 contains data.
Sheet2 is empty to start.

If these assumptions are not correct, you'll need to adjust the code accordingly.

VBA Code:
Sub PivotList()

Dim rngSource As Range, rngDest As Range

Set rngSource = Sheets("Sheet1").Range("A1")

Do Until rngSource.Value = ""

    Set rngDest = Sheets("Sheet2").Range("A:A")
    
    Set rngDest = rngDest.Find(What:=rngSource.Value, LookIn:=xlValues, LookAt:=xlWhole)
    
    If rngDest Is Nothing Then
        Set rngDest = Sheets("Sheet2").Range("A1")
        If rngDest.Value <> "" Then
            If rngDest.Offset(1, 0) <> "" Then
                Set rngDest = rngDest.End(xlDown)
            End If
            Set rngDest = rngDest.Offset(1, 0)
        End If
        rngDest.Value = rngSource.Value
    End If
    
    Do Until rngDest.Value = ""
    
        Set rngDest = rngDest.Offset(0, 1)
    
    Loop
    
    rngDest.Value = rngSource.Offset(0, 1).Value
        
    Set rngSource = rngSource.Offset(1, 0)
Loop


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,840
Members
449,411
Latest member
adunn_23

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