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

  • Home
  • SEARCH
  • 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 8884051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:58:14+00:00 2026-06-14T20:58:14+00:00

I need to collate data from 3 Excel spreadsheets in a very specific way,

  • 0

I need to collate data from 3 Excel spreadsheets in a very specific way, but I’m having absolutely no luck in finding the functions or commands I need to use and for some reason even Google isn’t helping me today.

For each line of Sheet1 I want to “Find All rows on Sheet2 WHERE Sheet1 ColumnA is LIKE Sheet 2 ColumnA AND Sheet1 ColumnB is LIKE Sheet2 ColumnB”. I think I could probably use EQUALS instead of LIKE with a wildcard character.

Then, for each result that is found by the first query I want to insert a new row below the current row in Sheet1 and copy the data from Sheet2 ColumnC into the newly inserted row ColumnC. I imagine I’m also going to need to have counted the amount of rows returned by the first query so that I can tell it to skip that many rows before repeating the loop, although even if it performs the loop on those new rows it shouldn’t find any results anyway.

Obviously is someone wants to write the code for me then I’d be overjoyed! 🙂
But even if anyone is able to let me know the best functions to use for each bit I need then I will still be most grateful, and just research them and put something together myself.

Thanks in advance,

Joe

Edit

Added Examples below, first sheet 1, then sheet 2, then the desired result of sheet 1 after the macro has been run. Also above I stated I would be searching for “LIKE” matches, however it would be more accurate to say I want to search where CELL CONTAINS

Sheet 1 Before Macro

Sheet 2 Containing Info

Sheet 1 After Macro

  • 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-14T20:58:16+00:00Added an answer on June 14, 2026 at 8:58 pm

    Well, the following is my solution. By the way, if you can guarantee that the cells are already sorted, the code can be optimized for reducing comparison times.

    //Code is not tested
    Sub Collate()
    
        Dim row1 As Long
        Dim row2 As Long
        Dim match As Boolean
    
        Dim lastRow1 As Long
        Dim lastRow2 As Long
    
        Dim valA1 As String
        Dim valB1 As String
        Dim valA2 As String
        Dim valB2 As String
        Dim valC2 As String
    
        lastRow1 = Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Row
        lastRow2 = Sheet2.Cells.SpecialCells(xlCellTypeLastCell).Row
    
        row1 = 2
        While row1 <= lastRow1
            valA1 = "*" & Sheet1.Cells.Range("A" & row1).Value & "*"
            valB1 = "*" & Sheet1.Cells.Range("B" & row1).Value & "*"
            For row2 = 2 To lastRow2
                valA2 = Sheet2.Cells.Range("A" & row2).Value
                valB2 = Sheet2.Cells.Range("B" & row2).Value
                valC2 = Sheet2.Cells.Range("C" & row2).Value
                If valA2 Like valA1 And valB2 Like valB1 Then
                    match = True
                    row1 = row1 + 1
                    lastRow1 = lastRow1 + 1
                    Sheet1.Cells.Range("A" & row1).EntireRow.Insert
                    Sheet1.Cells.Range("C" & row1).Value = valC2
                End If
            Next row2
    
            row1 = row1 + 1
        Wend
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have 500 excel sheets which are used for data collection from various organisations
Need help getting Ember-Data working with Zend Rest. At first, I'm familiar with Zend
I am a .net beginner. I need to add some data to xml file
I have a model that was generated for MySQL 5 but now I need
I am getting a CSV from a client, I need to import that file
I have a text file which contains the text DATA collate UNKNOWN null, or
I have a number of tables I need to convert from mySQL to SQL
Short Question: Is there a way to tell CoreData to use COLLATE while creating
I'm stuck outputting data from a table like this. This is a table for
Is there a better way to merge/collate a bunch of sorted iterators into one

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.