Consolidating two worksheets onto a third worksheet

mrzesty973

New Member
Joined
Jan 8, 2017
Messages
3
Hi,


Trying to consolidate 2 worksheets that have invoice numbers and payment status onto one worksheet but having difficulty. :(


The solution shows the invoice numbers in ascending order and when a match is made the invoice numbers and their status should be put onto the same row. If a match is not made, then the word missing should be inserted.


Sample screen shot with three worksheets shows the two lists on AR & AP and the desired output on the tab called Recon.

AR List

Excel 2012
AB
1Invoice NumberStatus
2A1Unpaid
3A4Unpaid
4A701Unpaid
5A2Unpaid
6A6Waiting
7A701Unpaid

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
AR



AP List

Excel 2012
AB
1Invoice NumberStatus
2A3Paid
3A701Paid
4A1Paid
5A5Paid
6A701Paid
7A6Waiting

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
AP



Recon
Excel 2012
ABCDE
1AR InvoiceAR StatusAP InvoiceAP Status
2A1UnpaidA1Paid
3A2UnpaidMissingMissing
4MissingMissingA3Paid
5A4UnpaidMissingMissing
6MissingMissingA5Paid
7A6WaitingA6Waiting
8
9AR DuplicatesAP Duplicates
10A701UnpaidA701Paid
11A701UnpaidA701Paid

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Recon





Thank you ahead of time for reading this post and any help.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi

How are you hoping to acomplish this.
VBA?

Additioanally
Is the Recon Page how you wish your data to be laid out. With the duplicates under the unique instances with a 1 empty row between.

I assume your data actual data has far more rows than what you have posted.

Dave
 
Last edited:
Upvote 0
See if you can use this. It uses a third sheet for the consolidated data.

Code:
Sub t()
Dim ary As Variant, fn As Range, i As Long, fAdr As String
Sheet1.Columns(1).Insert
Sheet1.Range("B2", Sheet1.Cells(Rows.Count, 2).End(xlUp)).Copy Sheet1.Range("A2")
Sheet2.Range("A2", Sheet2.Cells(Rows.Count, 1).End(xlUp)).Copy Sheet1.Cells(Rows.Count, 1).End(xlUp)(2)
Sheet1.Range("A1") = "x"
Sheet1.Range("A1", Sheet1.Cells(Rows.Count, 1).End(xlUp)).AdvancedFilter xlFilterCopy, , Sheet1.Cells(Rows.Count, 1).End(xlUp)(2), True
Sheet1.Range("A1").ClearContents
Set fn = Range(Sheet1.Range("A:A").Find("x", , xlValues), Sheet1.Cells(Rows.Count, 1).End(xlUp))
fn.Sort Sheet1.Cells(Rows.Count, 1).End(xlUp), xlAscending
'rw = fn.Rows(1).Row
ary = Application.Transpose(fn)
Sheet1.Columns(1).Delete
    For i = LBound(ary) To UBound(ary) - 1
            Set fn = Sheet1.Range("A:A").Find(ary(i), , xlValues, xlWhole)
            If Not fn Is Nothing Then
                fAdr = fn.Address
                    Do
                    Sheet3.Cells(Rows.Count, 1).End(xlUp)(2) = fn.Value
                    Sheet3.Cells(Rows.Count, 1).End(xlUp).Offset(, 1) = fn.Offset(, 1).Value
                    Set fn = Sheet1.Range("A:A").FindNext(fn)
                    Loop While fn.Address <> fAdr
            Else
                Sheet3.Cells(Rows.Count, 1).End(xlUp)(2) = "Missing"
            End If
        Set fn = Sheet2.Range("A:A").Find(ary(i), , xlValues, xlWhole)
            If Not fn Is Nothing Then
                fAdr = fn.Address
                    Do
                    Sheet3.Cells(Rows.Count, 3).End(xlUp)(2) = fn.Value
                    Sheet3.Cells(Rows.Count, 3).End(xlUp).Offset(, 1) = fn.Offset(, 1).Value
                    Set fn = Sheet2.Range("A:A").FindNext(fn)
                    Loop While fn.Address <> fAdr
            Else
                Sheet3.Cells(Rows.Count, 3).End(xlUp)(2) = "Missing"
            End If
    Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,221
Messages
6,123,701
Members
449,117
Latest member
Aaagu

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