Compiling Values

zoya25

New Member
Joined
Jan 24, 2018
Messages
4
Hello,

So I am trying to track the status of multiple work products on a day to day basis using Excel Macros. I am trying to run a loop checking each row in sheet 1 against sheet 2. And if the value doesn't exist in sheet 2 then inputting it in sheet 2 towards the end of the records without erasing any existing records. Essentially compiling the values. I want to do this only for 5 columns. Would really appreciate your help.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Welcome to the Board!

When you are relating two different tables of data like this, what you are really describing is a relational database.
As such, it is usually much easier to use a relational database program, like Microsoft Access, instead of Excel (which is NOT a relational database program).
Do you have Microsoft Access?

Basically, what you would be doing is an Unmatched Query from one table to the other, when joining them on all 5 fields.
 
Upvote 0
I was actually able to do this in Macros using a Loop with if statement embedded in it

Sub process_data()
Set sh = Sheet1
Set res = Sheet14
On Error Resume Next


For i = 2 To sh.Range("A" & Rows.Count).End(xlUp).Row
isMatch = ""
isMatch = WorksheetFunction.Match(sh.Range("A" & i), res.Range("B:B"), 0)
If Len(isMatch) > 0 Then
res.Range("D" & isMatch) = sh.Range("F" & i)
Else
nRow = res.Range("A" & Rows.Count).End(xlUp).Row + 1
res.Range("B" & nRow) = sh.Range("A" & i)
res.Range("A" & nRow) = sh.Range("I" & i)
res.Range("C" & nRow) = sh.Range("B" & i)
res.Range("D" & nRow) = sh.Range("F" & i)
End If
nxti:
Next i


res.Activate


End Sub
 
Upvote 0
Glad you figured something out.

I never said you couldn't use Excel to do it, I was just asking if you had Access at your disposal. If so, then there is no sense in recreating the wheel, when you can use a tool that was designed for precisely that purpose.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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