Combining Data from two reports

emcgaffin

New Member
Joined
Sep 8, 2017
Messages
10
Every week I pull a report from a CRM (Report 1) and then a separate report from a program that records our internet activity (report 2).

Report 1: Shows a customers name, stock number, deal stage, date created and date of last engagement.


CustomerStock #StageCreatedEngaged
John S456789Visit9/1/179/5/17
Dwight RTMK425Proposal9/2/179/4/17

<tbody>
</tbody>


Report 2: Shows the stock number, Make, Model, VDP Views, avg VDP views per day

Stock #MakeModelVDP ViewsAvg VDP Per Day
456789BMW331.50
TMK425ChevyImpala11

<tbody>
</tbody>


End Goal: Combine the two reports so that I can sort the data by using a simple pivot table. Is there a way for me to look at the column containing the stock number in report 1 (column B) and if there is a match (there will be multiple matches for the same stock number) I would like data in columns B,C,D,E from report 2 to be added to columns F,G,H,I in Report 1?

CustomerStock #StageCreatedEngagedMakeModelVDP ViewsAVG VDP Per Day
John S456789Visit9/1/179/5/17BMW331.5
Dwight RTMK425Proposal9/2/179/4/17ChevyImpala11

<tbody>
</tbody>

Thank you for the help. Please let me know if this is unclear
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Are the reports in separate workbooks (files)? If so, what are the workbook names, with file extensions? What is the worksheet name for each report?
 
Upvote 0
The reports are in separate workbooks. I usually just cut and paste one into the other. Report 1 is called CRM Customers.xls and report 2 is called VDPs.xls.
 
Upvote 0
All things equal, if you have the resources available to you, this task is pretty easy to do in Microsoft Access. What you are describing is a relational database structure, and that is what Access was built for.
 
Upvote 0
This is untested but what it should do is walk down column b of your customer workbook and look for each stock number in the VDP workbook. If found, it will copy the last four columns of VDP to Customer beginning in column F of the corresponding row for the stock number.
Code:
Sub t()
Dim wb1 As Workbook, wb2 As Workbook, sh1 As Worksheet, sh2 As Worksheet, fn As Range
Set wb1 = Workbooks("CRM Customers.xls")
Set wb2 = Workbooks("VDPs.xls")
Set sh1 = wb1.Sheets(1)
Set sh2 = wb2.Sheets(1)
    For Each c In sh1.Range("B2", sh1.Cells(Rows.Count, 2).End(xlUp))
        If c <> "" Then
            Set fn = sh2.Range("A2", sh2.Cells(Rows.Count, 1).End(xlUp)).Find(c.Value, , xlValues, xlWhole)
                If Not fn Is Nothing Then
                    fn.Offset(, 1).Resize(1, 4).Copy c.Offset(, 4)
                End If
        End If
    Next
End Sub
You stated that the stock number may occur more than once but did not specify in which sheet, of if in both, so that might need some attention.
In the mean time, you might want to pursue the suggestion by Joe4 to switch to Access.
 
Upvote 0
Hi Joe4, I would love Access. The company I work for now doesn't have a need yet but I'm working on that haha!
 
Upvote 0
Hi JLGWhiz!!! This is amazing. That is exactly what I needed. I also realized that I need to spend a considerable amount of time learning VBA! Have a great day!
 
Upvote 0
Hi JLGWhiz!!! This is amazing. That is exactly what I needed. I also realized that I need to spend a considerable amount of time learning VBA! Have a great day!
Glad you could use it. Been having a little hurricane problem here, just got back on line.
Regards, JLG
 
Upvote 0

Forum statistics

Threads
1,214,656
Messages
6,120,762
Members
448,991
Latest member
Hanakoro

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