Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9174269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:43:28+00:00 2026-06-17T16:43:28+00:00

I have several columns of dates, which I have distilled down into one master

  • 0

I have several columns of dates, which I have distilled down into one master list, that contains all the dates each list has in common. Therefore any value in this list MUST be found in all the other columns.

I have several tables of data, across multiple sheets (which has dates in one column and values in the adjacent one), the columns of dates are fed from each table of data in these sheets, so these sheets may contain dates that are not found in the master list.

I want to copy and paste into adjacent columns, on each of these sheets, all the dates and their corresponding values that are contained in the master list.

Example (all listed on separate sheets, in range F13:GX)
(use sheet names of List 1, List 2, List 3 etc). All the sheets in the workbook will contain a list, apart from one called “Cover”).
List 1

22/12/2012 1
23/12/2012 2
24/12/2012 3 
27/12/2012 4
28/12/2012 5

List 2

22/12/2012 2
23/12/2012 10
24/12/2012 11
28/12/2012 15

List 3

22/12/2012 2
23/12/2012 17
28/12/2012 22
29/12/2012 33 

I want it to copy and paste the dates and values for

22/12/2012 
23/12/2012 
28/12/2012

for each list, and paste them into the range H13:I15

so i would have as the desired output.

List 1

22/12/2012 1 22/12/2012 1
23/12/2012 2 23/12/2012 2
24/12/2012 3 28/12/2012 5 
27/12/2012 4
28/12/2012 5

List 2

22/12/2012 2  22/12/2012 2
23/12/2012 10 23/12/2012 10
24/12/2012 11 28/12/2012 15
28/12/2012 15

List 3

22/12/2012 2  22/12/2012 2
23/12/2012 17 23/12/2012 17
28/12/2012 22 28/12/2012 22
29/12/2012 33

There would be no blanks when values are skipped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:43:29+00:00Added an answer on June 17, 2026 at 4:43 pm

    The simplest solution would be to use formulas rather than a macro.

    For the example given, enter this formula in H3 of every “List” sheet:

    =IFERROR(INDEX(MasterList,ROW()-ROW(F$13)+1),"")

    and this one in I3:

    =IF(H13="","",INDEX(G:G,MATCH(H13,F:F,0)))

    Copy/fill the formula down as far as necessary.

    MasterList is a Named Range referring to the master list of dates. A dynamic example, assuming the master list starts in cell A1 of a sheet named “Master” (with nothing else in the column), would be:

    =Master!$A$1:INDEX(Master!A:A,COUNTA(Master!A:A))

    You could, if so inclined, insert this directly into the first formula above.

    Note: I kept the second formula above as simple as possible. As a result, it will break if there are any dates (or number equivalents) in the range F1:F12 matching the master list.

    If you really want/need a macro solution the following “fairly simple” one should do the trick:

    Public Sub PasteMasterDates()
    
      Dim fn As WorksheetFunction: Set fn = Application.WorksheetFunction
    
      Dim wkstWorkSheet As Worksheet
      Dim varMasterArray As Variant
      Dim varDatesArray As Variant
      Dim varValuesArray As Variant
      Dim lngMasterUBound As Long
      Dim lngMasterIndex As Long
      Dim lngMatchIndex As Long
      Dim varNumberFormat As Variant
    
      With Worksheets("Master")
        With Range(.Range("A1:B1"), .Range("A1").End(xlDown))
          varNumberFormat = .Cells(1).NumberFormat
          varMasterArray = fn.Transpose(fn.Transpose(.Cells))
          lngMasterUBound = UBound(varMasterArray, 1)
        End With
      End With
      For Each wkstWorkSheet In Application.Worksheets
        With wkstWorkSheet
          If .Name Like "List *" Then
            With Range(.Range("F13"), .Range("F13").End(xlDown))
              varDatesArray = fn.Transpose(.Cells)
              varValuesArray = fn.Transpose(.Cells.Offset(ColumnOffset:=1))
              For lngMasterIndex = 1 To lngMasterUBound
                lngMatchIndex = fn.Match(varMasterArray(lngMasterIndex, 1), varDatesArray, 0)
                varMasterArray(lngMasterIndex, 2) = varValuesArray(lngMatchIndex)
              Next lngMasterIndex
              With .Cells.Offset(ColumnOffset:=2).Resize(RowSize:=lngMasterUBound)
                .NumberFormat = varNumberFormat
                .Resize(ColumnSize:=2) = varMasterArray
              End With
            End With
          End If
        End With
      Next wkstWorkSheet
    
    End Sub
    

    Important points:

    1. The master list is assumed to be in a sheet named “Master” as per the formula solution above.
    2. Whilst this now works even if there are dates/numbers in the range F1:F12 matching the master list, it will break if rows are inserted above, or columns to the left of, F13. Until you fix the macro, that is.
    3. Adding/inserting dates into the “List” sheets, or adding more of these sheets, is automatically allowed for.
    4. The date format for the pasted values is copied from the first date in the master list.
    5. For speed reasons, the sheet data is loaded into VBA arrays. All calculations are done on these arrays before writing the results back to the sheet.

    Note: Since I presume you are already running a macro to generate the master list (doing so via formulas only would be difficult if not impossible), you could modify my macro to build the master list, like you currently do, before using it.
    Alternatively, you could build and use it without actually saving it to a sheet. I would suggest loading all the “List” sheet data into an array of arrays, at the same time as building the master list using a dictionary. Then you loop over the array of arrays again, this time using the master list to generate the results.

    EDIT:

    This version of the macro allows for dates in the master list that are not in every one of the other lists.

    Public Sub PasteMasterDates2()
    
      Const cMasterSheetName As String = "Master"
      Const cMasterStart As String = "A1"
      Const cLikeListSheetName As String = "List *"
      Const cListStart As String = "F13"
    
      Dim fn As WorksheetFunction: Set fn = Application.WorksheetFunction
    
      Dim wkstWorkSheet As Worksheet
      Dim varMasterArray As Variant
      Dim varDatesArray As Variant
      Dim varValuesArray As Variant
      Dim avarPasteDatesArray() As Double
      Dim avarPasteValuesArray() As Double
      Dim lngMasterUBound As Long
      Dim lngListUBound As Long
      Dim lngPasteUBound As Long
      Dim lngMasterIndex As Long
      Dim lngMatchIndex As Long
      Dim varNumberFormat As Variant
    
      With Worksheets(cMasterSheetName)
        With Range(.Range(cMasterStart), .Range(cMasterStart).End(xlDown))
          varNumberFormat = .Cells(1).NumberFormat
          varMasterArray = fn.Transpose(.Cells)
          lngMasterUBound = UBound(varMasterArray)
        End With
      End With
      For Each wkstWorkSheet In Application.Worksheets
        With wkstWorkSheet
          If .Name Like cLikeListSheetName Then
            With Range(.Range(cListStart), .Range(cListStart).End(xlDown))
              varDatesArray = fn.Transpose(.Cells)
              varValuesArray = fn.Transpose(.Cells.Offset(ColumnOffset:=1))
              lngListUBound = UBound(varDatesArray, 1)
              ReDim avarPasteDatesArray(1 To lngListUBound)
              ReDim avarPasteValuesArray(1 To lngListUBound)
              lngPasteUBound = 0
              For lngMasterIndex = 1 To lngMasterUBound
                lngMatchIndex = 0
                On Error Resume Next
                lngMatchIndex = fn.Match(varMasterArray(lngMasterIndex), varDatesArray, 0)
                On Error GoTo 0
                If lngMatchIndex _
                Then
                  lngPasteUBound = lngPasteUBound + 1
                  avarPasteDatesArray(lngPasteUBound) = varDatesArray(lngMatchIndex)
                  avarPasteValuesArray(lngPasteUBound) = varValuesArray(lngMatchIndex)
                End If
              Next lngMasterIndex
              If lngPasteUBound _
              Then
                ReDim Preserve avarPasteDatesArray(1 To lngPasteUBound)
                ReDim Preserve avarPasteValuesArray(1 To lngPasteUBound)
                With .Cells.Offset(ColumnOffset:=2).Resize(RowSize:=lngPasteUBound)
                  .NumberFormat = varNumberFormat
                  .Cells = fn.Transpose(avarPasteDatesArray)
                  .Offset(ColumnOffset:=1) = fn.Transpose(avarPasteValuesArray)
                End With
              End If
            End With
          End If
        End With
      Next wkstWorkSheet
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table containing several columns, one of which is a date column
I have a several columns in my excel worksheets which are all named as
I have several datasets i.e. matrices that have a 2 columns, one with a
I have several columns in a MySQL database that I would like to add
I have several columns that I'd like to search against. My code might not
I have several TextField columns on my UserProfile object which contain JSON objects. I've
I have a csv that has several columns. I need the middle columns to
I have a file from which I've output several columns of information, 4 to
I have a table called scheduler_sched which has several columns, including a column called
I have a multithreaded process which inserts several records into a single table. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.