Lookup between 2 tables and match the field and update the records

manshah

New Member
Joined
Jun 4, 2019
Messages
9
Hi

I have 2 tables as shown below. I want to look up the "Field" column in Table 2 and and update the record in Table 1 for the column mentioned in "Field column of Table 2 based on most current "System Notes Date".
For Example: In Table 1, for document number OPP1003, "Exp.Close Date" should be updated to reflect 10/1/2019. Please see the table "Result" which shows the final output.

TABLE 1:
[TABLE="width: 1245"]
<colgroup><col><col><col><col><col><col><col><col span="4"><col></colgroup><tbody>[TR]
[TD][TABLE="width: 1093"]
<colgroup><col><col><col><col><col><col><col><col span="4"></colgroup><tbody>[TR]
[TD]Document Number[/TD]
[TD]Department[/TD]
[TD]Booking Date[/TD]
[TD]Sales Rep[/TD]
[TD]Exp. Close Date[/TD]
[TD]Opportunity Status[/TD]
[TD]Projected Total[/TD]
[TD]Probability[/TD]
[TD]Weighted Total[/TD]
[TD]Project Start Date[/TD]
[TD]Project End Date[/TD]
[/TR]
[TR]
[TD]OPP1003[/TD]
[TD]NE[/TD]
[TD]1/23/2019[/TD]
[TD]MD[/TD]
[TD]7/1/2019[/TD]
[TD]SP[/TD]
[TD] 14,500.00[/TD]
[TD]0.4[/TD]
[TD] 5,800.00[/TD]
[TD]9/6/2019[/TD]
[TD]12/31/2019[/TD]
[/TR]
[TR]
[TD]OPP1041[/TD]
[TD]SMB[/TD]
[TD]5/20/2019[/TD]
[TD]Marci Cap[/TD]
[TD]7/1/2019[/TD]
[TD]DNO[/TD]
[TD]8700[/TD]
[TD]0.2[/TD]
[TD]1740[/TD]
[TD]7/24/2019[/TD]
[TD]7/24/2019[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


TABLE 2:
[TABLE="width: 878"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Document Number[/TD]
[TD]Date Created[/TD]
[TD]System Notes Date[/TD]
[TD]Projected Total[/TD]
[TD] Field[/TD]
[TD]Old Value[/TD]
[TD]New Value[/TD]
[/TR]
[TR]
[TD]OPP1003[/TD]
[TD]9/11/2018 10:35[/TD]
[TD]7/24/2019 12:03[/TD]
[TD]14500[/TD]
[TD]Exp. Close Date[/TD]
[TD]7/26/2019[/TD]
[TD]8/30/2019[/TD]
[/TR]
[TR]
[TD]OPP1003[/TD]
[TD]9/11/2018 10:35[/TD]
[TD]7/24/2019 12:03[/TD]
[TD]14500[/TD]
[TD]Project Start Date[/TD]
[TD]9/6/2019[/TD]
[TD]9/20/2019[/TD]
[/TR]
[TR]
[TD]OPP1003[/TD]
[TD]9/11/2018 10:35[/TD]
[TD]7/30/2019 15:43[/TD]
[TD]14500[/TD]
[TD]Exp. Close Date[/TD]
[TD]8/30/2019[/TD]
[TD]10/1/2019[/TD]
[/TR]
[TR]
[TD]OPP1003[/TD]
[TD]9/11/2018 10:35[/TD]
[TD]7/30/2019 15:43[/TD]
[TD]14500[/TD]
[TD]Project Start Date[/TD]
[TD]9/20/2019[/TD]
[TD]10/31/2019[/TD]
[/TR]
[TR]
[TD]OPP1041[/TD]
[TD]9/11/2018 19:53[/TD]
[TD]7/18/2019 9:04[/TD]
[TD]8700[/TD]
[TD]Exp. Close Date[/TD]
[TD]7/24/2019[/TD]
[TD]8/6/2019[/TD]
[/TR]
[TR]
[TD]OPP1041[/TD]
[TD]9/11/2018 19:53[/TD]
[TD]7/18/2019 9:04[/TD]
[TD]8700[/TD]
[TD]Project End Date[/TD]
[TD]7/24/2019[/TD]
[TD]8/6/2019[/TD]
[/TR]
[TR]
[TD]OPP1041[/TD]
[TD]9/11/2018 19:53[/TD]
[TD]7/18/2019 9:04[/TD]
[TD]8700[/TD]
[TD]Project Start Date[/TD]
[TD]7/24/2019[/TD]
[TD]8/6/2019[/TD]
[/TR]
[TR]
[TD]OPP1041[/TD]
[TD]9/11/2018 19:53[/TD]
[TD]7/18/2019 9:05[/TD]
[TD]8700[/TD]
[TD]Probability[/TD]
[TD]20[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]OPP1041[/TD]
[TD]9/11/2018 19:53[/TD]
[TD]7/18/2019 9:05[/TD]
[TD]8700[/TD]
[TD]Projected Total[/TD]
[TD]8700.00[/TD]
[TD]5220.00[/TD]
[/TR]
</tbody>[/TABLE]

RESULT:
[TABLE="width: 1209"]
<colgroup><col><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Document Number[/TD]
[TD]Department[/TD]
[TD]Booking Date[/TD]
[TD]Sales Rep[/TD]
[TD]Exp. Close Date[/TD]
[TD]Opportunity Status[/TD]
[TD]Projected Total[/TD]
[TD]Probability[/TD]
[TD]Weighted Total[/TD]
[TD]Project Start Date[/TD]
[TD]Project End Date[/TD]
[/TR]
[TR]
[TD]OPX1003[/TD]
[TD]NE[/TD]
[TD]1/23/2019[/TD]
[TD]MD[/TD]
[TD]10/1/2019[/TD]
[TD]SP[/TD]
[TD] 14,500.00[/TD]
[TD]0.4[/TD]
[TD] 5,800.00[/TD]
[TD]10/31/2019[/TD]
[TD]12/31/2019[/TD]
[/TR]
[TR]
[TD]OPX1041[/TD]
[TD]SMB[/TD]
[TD]5/20/2019[/TD]
[TD]Marci Cap[/TD]
[TD]8/6/2019[/TD]
[TD]DNO[/TD]
[TD]5220[/TD]
[TD]0.5[/TD]
[TD]2610[/TD]
[TD]8/6/2019[/TD]
[TD]8/6/2019[/TD]
[/TR]
</tbody>[/TABLE]


I have thousands of records of similar data and looking for formula or code to automate the process.

Any help is greatly appreciated. Thank you!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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