Excel Data Pull

RTAssocia

New Member
Joined
Dec 13, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Apologies if posted elsewhere, however, I have been unable to successfully locate how to perform the below action.
I have Two Workbooks, WB1 & WB2, both have no more than 4000 line items in each workbook.
In WB1 I have entries within Column G that I need to bring over into WB2.

I am trying only to pull from WB1 into WB2, those which have exact matching values from Column B in WB2 & Column A in WB1.
AAm explaining this question right? I'm at wits end trying to figure this out, please help!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Welcome to the forum!
Just a few questions..
Which workbook will the code be sitting in? Will both workbooks already be open? What are the names of the 2 workbooks? Is row 1 in each workbook a header row & does the data start in row 2? Is it just constants that are being copied, or is it the values returned from formulas & do you only want the values copied? Do you want the values copied to the first available (empty) row in WB2 - and to which column? Is it just column G values you want copied (not the entire row)?
It would really help if you could provide copies of your 2 workbooks using the XL2BB add in.
 
Upvote 0
HI :D & Thank you!!

The code would sit in WB 2, within Column G.
Both Workbooks would be open, with 1st Row as Header & Data start on 2nd row.
Trying to have the data within WB1 G Column populate within WB2 Column G- only if matching values are found within WB2 Column A, against WB1 Column A.


WB1:
WB1.xlsx
ABCDEFGHIJKLMN
1A_IDO_F_NH_PW_PM_PO_PE_AE_CE_RE_PE_P2E_P3O_TU_A
21234567890K123-456-7890k@mail.comkf123-456-7890
Sheet1
v

WB2:
WB2.xlsx
ABCDEFGHIJKLM
1A_ID1A_ID2T_DT_AT_RT_CColumn1A_NC_DA_N2C_017C_018A_R_N
2123412345678901/1/2023 00:000ggagmartc1/1/2023 00:0012/1/2023 00:00rtc
Sheet1
 
Upvote 0
Thank you for that. They look like tables, not ranges - are they?
 
Upvote 0
With Power Query, bring each table into the PQ Editor. Join the two table in a Merge on the common field. (Outer Join). In the new column created extract only the field required. Close and Load the combined data to Excel.

Power Query is an integral part of O365 and is called Get and Transform Data and found on the Data Tab of the Ribbon.

 
Upvote 0
Is it simply the case that you want to return the email addresses from column G of WB1 to column G of WB2 - if it finds a match column B in WB2 in column A in WB1? If that is the case, then try the following code on a copy of your workbooks. Please make sure that the table names are changed to whatever your actual table names are, and that both workbooks are open at the time you run the code. This code must sit in a standard module in WB2.

VBA Code:
Sub WB1_WB2()
    With ThisWorkbook.Worksheets("Sheet1").Range("G2")
        .Formula = "=XLOOKUP([@[A_ID2]],WB1.xlsx!Table1[A_ID],WB1.xlsx!Table1[E_A],"""")"
        .Value = .Value
    End With
End Sub
 
Upvote 1
To check multiple values:
VBA Code:
Sub WB1_WB2()
    With ThisWorkbook.Worksheets("Sheet1").Range("G2:G" & Cells(Rows.Count, "G").End(xlUp).Row)
        .Formula = "=XLOOKUP([@[A_ID2]],WB1.xlsx!Table1[A_ID],WB1.xlsx!Table1[E_A],"""")"
        .Value = .Value
    End With
End Sub
 
Upvote 1

Forum statistics

Threads
1,215,193
Messages
6,123,566
Members
449,108
Latest member
rache47

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