Using Index Match and an array formula for isolating error(s) between two data sets

senoritacoconuts

New Member
Joined
Mar 8, 2017
Messages
3
I am trying to easily reconcile two different accounting reports: one from our local system, and one from our accounts payable department. I've copied and pasted the data into a sheet as follows and am trying to determine where there are discrepancies between them:

From our local system (lines 2-1923)
Column B - Invoice #
Column C - Account
Column D - Project
Column E - Fund Total

From our accounts payable system (lines 2-1820)
Column I - Invoice #
Column J - Account
Column K - Project
Column L - Fund Total

In cell M2, I created the following array formula:
{=INDEX($E$2:$E$1923,MATCH(I2&J2&K2&L2,$B$2:$B$1923&$C$2:$C$1923&$D$2:$D$1923&$E$2:$E$1923,0))}

For example, the data in cells B2-E2 (which is one accounting 'string') must match on a corresponding row or 'string' in columns I-L exactly. My formula above works well, in that I get an "#N/A" in column M when there is an error found. However, ideally I would like a formula perhaps in multiple cells (one for each data element), that would show where the error is. In other words, what exactly is incorrect, the invoice number, or the account, or the project? Any helpful suggestions? I've been trying unsuccessfully over the last few weeks and am finally turning to you guys for help!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Welcome to the forum!

Here's one (lengthy!) possibility:

ABCDEFGHIJKLMN
1Invoice #AccountProjectFund TotalInvoice #AccountProjectFund Total
2111A10111A1010
3222B20222B2020
4333C30333C35#N/AFund total does not match, or more than one component does not match
5444D404444D40#N/AAccount=44
6555E50555EE50#N/AProject=E
7666F606666FFF60#N/AFund total does not match, or more than one component does not match
8777G707177G70#N/AInvoice=7
9888H804299I90#N/AInvoice=9
10999I900
111099I900
12

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

Array Formulas
CellFormula
N2{=IF(NOT(ISERROR(M2)),"",IFERROR("Invoice="&INDEX($B$2:$B$1923,MATCH(J2&"|"&K2&"|"&L2,$C$2:$C$1923&"|"&$D$2:$D$1923&"|"&$E$2:$E$1923,0)),IFERROR("Account="&INDEX($C$2:$C$1923,MATCH(I2&"|"&K2&"|"&L2,$B$2:$B$1923&"|"&$D$2:$D$1923&"|"&$E$2:$E$1923,0)),IFERROR("Project="&INDEX($D$2:$D$1923,MATCH(I2&"|"&J2&"|"&L2,$B$2:$B$1923&"|"&$C$2:$C$1923&"|"&$E$2:$E$1923,0)),"Fund total does not match, or more than one component does not match"))))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



The table is as you describe, and your formula in in column M. I added the array formula in N2, and copied down. It essentially looks for a match using Account/Project/Fund, and if it finds it, lists the matching Invoice. If it doesn't find it, tries with Invoice/Project/Fund, if that's not found, tries with Invoice/Account/Fund.

It's not perfect. Notice in N9 it says it should be Invoice 9, but if you look at the original table, there are actually 2 line items that match, excluding Invoice, 9 and 10.

But it should help! :) Let me know.
 
Upvote 0
Thanks so much, Eric! I'm going to give this a try first thing tomorrow morning and will report back. Regardless of the outcome, I appreciate your help!
 
Upvote 0
Good Morning, Eric. So I tried your formula and it worked just as you suspected it would. It pinpoints exactly where the error is, which is more than I'd expected actually. What I was originally contemplating as a solution was separate "match" columns for each field invoice, account, project, fund total where an "#N/A" would appear if there was no match for that field. Thanks again for your elegant solution!
 
Upvote 0
My formula does exactly what you contemplated, it just bundles 3 INDEX/MATCH combinations in a single formula and tries them sequentially.

Glad I could help! :cool:
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,384
Members
449,080
Latest member
Armadillos

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