Collating data

Status
Not open for further replies.

Nova1979

Board Regular
Joined
Feb 4, 2020
Messages
111
Office Version
  1. 2010
Platform
  1. Windows
Hello all. Could someone please help. I am trying to pull all column data from multiple sheets (24 I total so far) into 1 master sheet without doubling up data. These are 9 digit numbers and some are on the same sheet multiple time and also across multiple sheets ie on sheet3, sheet4, sheet7 but I need it to show only once on the master sheet

On top of this is it possible to have it numerical? Or might this be too much and just easier to sort?

Thanks in advance.
 
Reference Sheet1
1581296953782.png


Reference Sheet2
1581297011165.png


Result
1581297048963.png


With any luck, this might clear things up a little
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You can see there are duplicates in sheet1 and sheet2, however there are aslo duplicates on the same sheet.
(To replicate this, change Sheet1 row3 to 200105 X RING)
you can also see on the master (result) that with column A, this has expanded to columns B and C
 
Upvote 0
Ru this macro:

VBA Code:
Sub Collating_data()
  Dim sh As Worksheet, dic As Object, ky As Variant
  Dim a As Variant, i As Long
  
  Sheets("Master").Cells.ClearContents
  Set dic = CreateObject("Scripting.Dictionary")
  For Each sh In Sheets(Array("Sheet1", "Sheet2"))
    a = sh.Range("A1:C" & sh.Range("A" & Rows.Count).End(xlUp).Row).Value2
    For i = 1 To UBound(a)
      dic(a(i, 1)) = a(i, 2) & "|" & a(i, 3)
    Next
    Erase a
  Next
  ReDim a(1 To dic.Count, 1 To 2)
  i = 1
  For Each ky In dic.keys
    a(i, 1) = Split(dic(ky), "|")(0)
    a(i, 2) = Split(dic(ky), "|")(1)
    i = i + 1
  Next
  Sheets("Master").Range("A1").Resize(dic.Count).Value = Application.Transpose(dic.keys)
  Sheets("Master").Range("B1").Resize(dic.Count, 2).Value = a
End Sub

_____________________________________
HOW TO INSTALL MACROs
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (Collating_data) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "Yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
No idea on macros. If I adjust data to reference sheet (add, delete or change) will the changes occur in the master sheet automatically like a formula?
 
Upvote 0
No idea on macros. If I adjust data to reference sheet (add, delete or change) will the changes occur in the master sheet automatically like a formula?

Above I put the explanation of how to use a macro.
No, after making changes you must run the macro.
It can be adapted to update automatically.

If you require a formula, hopefully someone on the board will help us find the solution.
 
Upvote 0
I will try the macro

Thank you very much for you time and help. It is very much appreciated
 
Upvote 0
try Power Query (add-in from MS site for XL 2010)
Code:
let
    Source = Table.Combine({Table1, Table2}),
    RemDuplicates = Table.Distinct(Source),
    Sort = Table.Sort(RemDuplicates,{{"Column1", Order.Ascending}})
in
    Sort
Column1Column2Column3
200067XRING
200105XRING
200203XRING
599265XHEXAGON
742072XELECTRICAL
1338696XELECTRICAL
1651978XRING
6197158XCOTTER
10165674XFITTING
10744980XHEXAGON
13794226XCOTTER
 
Upvote 0
Hi sandy. Thank you for your suggestion. Due to the system I am using and the security restrictions in place, I can not get access to add-ins. I had a gentleman help earlier and he gave me a macro.
I have spoken to the others utilising the workbook, and I they would idealy like a formula , where people do need to remeber to run the macro.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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