Find Pairs of Cells that Net to Zero and Highlight

toonces

New Member
Joined
Dec 4, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I've been trying to find a solution for this and I'm not sure of the best way to approach it. I have a sheet of transaction data where I need to find pairs of transactions that net to zero, then highlight those. I have the sheet sorted by Bill of Lading Date, then by Buyer Name.

Each pair must have the same Buyer Name and Bill of Lading Date. And some of the pairs will not have a Buyer Name, so I would match on amount only.

Also, as you can see from the data listed, the pairs won't always be consecutive (there may be a cell with a different value between 2 cells that net to zero).

I thought of doing an If AND statement, but I'm not sure how to get it to continue checking all of the cells if it doesn't find a match on the very next line. Also, I would need to make it so that once a pair has been found, neither of those are used again.

I'm open to any solutions including VBA, but I'm just not very experienced with it.

Any help would be greatly appreciated!

Bill Of Lading DateNet UnitsBuyer Name
3/6/2020​
-3984​
BLUE CO INC
3/6/2020​
3984​
BLUE CO INC
3/6/2020​
-3984​
DIAMOND CO INC
7/7/2020​
-5447​
SANTA INC
7/7/2020​
-2971​
SANTA INC
7/7/2020​
2971​
SANTA INC
7/7/2020​
3763​
SANTA INC
7/7/2020​
1684​
TARA INC
9/2/2020​
-5879​
RL INC
9/2/2020​
-2763​
RL INC
9/2/2020​
2763​
RL INC
9/2/2020​
5879​
RL INC
9/2/2020​
-6867​
STAR BAY INC
9/2/2020​
-1473​
STAR BAY INC
9/2/2020​
1473​
STAR BAY INC
9/2/2020​
6867​
STAR BAY INC
9/8/2020​
539​
WELL SPIN INC INC
9/8/2020​
-539​
WARM SERVICES INC
9/12/2020​
-4742​
P COMPANY
9/12/2020​
-4742​
P COMPANY
9/12/2020​
-3636​
P COMPANY
9/12/2020​
-3636​
P COMPANY
9/12/2020​
3636​
P COMPANY
9/12/2020​
3636​
P COMPANY
9/12/2020​
4742​
P COMPANY
9/12/2020​
4742​
P COMPANY
9/14/2020​
-30087​
9/14/2020​
-30087​
9/14/2020​
-30087​
9/14/2020​
-30087​
9/14/2020​
-30087​
9/14/2020​
-30087​
9/14/2020​
30087​
9/14/2020​
30087​
9/14/2020​
30087​
9/14/2020​
30087​
9/14/2020​
30087​
9/14/2020​
30087​
9/14/2020​
-29663​
9/14/2020​
-29663​
9/14/2020​
-29663​
9/14/2020​
-29663​
9/14/2020​
29663​
9/14/2020​
29663​
9/14/2020​
29663​
9/14/2020​
29663​
9/14/2020​
-31098​
9/14/2020​
-31098​
9/14/2020​
-31098​
9/14/2020​
-31098​
9/14/2020​
31098​
9/14/2020​
31098​
9/14/2020​
31098​
9/14/2020​
31098​
9/16/2020​
-4675​
P COMPANY
9/16/2020​
-1868​
P COMPANY
9/16/2020​
1868​
P COMPANY
9/16/2020​
4675​
P COMPANY
9/18/2020​
-4950​
ARTO INC
9/18/2020​
-4950​
ARTO INC
9/18/2020​
-1884​
ARTO INC
9/18/2020​
-1884​
ARTO INC
9/18/2020​
1884​
ARTO INC
9/18/2020​
4950​
ARTO INC
 

Attachments

  • excel help.png
    excel help.png
    46 KB · Views: 4

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi Toonces,

If I can use worker columns:
Toonces.xlsx
ABCDEFG
1Bill Of Lading DateNet UnitsBuyer NameConcat 1Matched rowBack to
23/6/2020-3984BLUE CO INC-3984BLUE CO INC438963 
33/6/20203984BLUE CO INC3984BLUE CO INC43896 2
43/6/2020-3984DIAMOND CO INC-3984DIAMOND CO INC43896  
57/7/2020-5447SANTA INC-5447SANTA INC44019  
67/7/2020-2971SANTA INC-2971SANTA INC440197 
77/7/20202971SANTA INC2971SANTA INC44019 6
87/7/20203763SANTA INC3763SANTA INC44019  
97/7/20201684TARA INC1684TARA INC44019  
109/2/2020-5879RL INC-5879RL INC4407613 
119/2/2020-2763RL INC-2763RL INC4407612 
129/2/20202763RL INC2763RL INC44076 11
139/2/20205879RL INC5879RL INC44076 10
149/2/2020-6867STAR BAY INC-6867STAR BAY INC4407617 
159/2/2020-1473STAR BAY INC-1473STAR BAY INC4407616 
169/2/20201473STAR BAY INC1473STAR BAY INC44076 15
179/2/20206867STAR BAY INC6867STAR BAY INC44076 14
189/8/2020539WELL SPIN INC INC539WELL SPIN INC INC44082  
199/8/2020-539WARM SERVICES INC-539WARM SERVICES INC44082  
209/12/2020-4742P COMPANY-4742P COMPANY4408626 
219/12/2020-4742P COMPANY-4742P COMPANY4408627 
229/12/2020-3636P COMPANY-3636P COMPANY4408624 
239/12/2020-3636P COMPANY-3636P COMPANY4408625 
249/12/20203636P COMPANY3636P COMPANY44086 22
259/12/20203636P COMPANY3636P COMPANY44086 23
269/12/20204742P COMPANY4742P COMPANY44086 20
279/12/20204742P COMPANY4742P COMPANY44086 21
289/14/2020-30087-300874408834 
299/14/2020-30087-300874408835 
309/14/2020-30087-300874408836 
319/14/2020-30087-300874408837 
329/14/2020-30087-300874408838 
339/14/2020-30087-300874408839 
349/14/2020300873008744088 28
359/14/2020300873008744088 29
369/14/2020300873008744088 30
379/14/2020300873008744088 31
389/14/2020300873008744088 32
399/14/2020300873008744088 33
409/14/2020-29663-296634408844 
419/14/2020-29663-296634408845 
429/14/2020-29663-296634408846 
439/14/2020-29663-296634408847 
449/14/2020296632966344088 40
459/14/2020296632966344088 41
469/14/2020296632966344088 42
479/14/2020296632966344088 43
489/14/2020-31098-310984408852 
499/14/2020-31098-310984408853 
509/14/2020-31098-310984408854 
519/14/2020-31098-310984408855 
529/14/2020310983109844088 48
539/14/2020310983109844088 49
549/14/2020310983109844088 50
559/14/2020310983109844088 51
569/16/2020-4675P COMPANY-4675P COMPANY4409059 
579/16/2020-1868P COMPANY-1868P COMPANY4409058 
589/16/20201868P COMPANY1868P COMPANY44090 57
599/16/20204675P COMPANY4675P COMPANY44090 56
609/18/2020-4950ARTO INC-4950ARTO INC4409265 
619/18/2020-4950ARTO INC-4950ARTO INC44092  
629/18/2020-1884ARTO INC-1884ARTO INC4409264 
639/18/2020-1884ARTO INC-1884ARTO INC44092  
649/18/20201884ARTO INC1884ARTO INC44092 62
659/18/20204950ARTO INC4950ARTO INC44092 60
Sheet1
Cell Formulas
RangeFormula
E2:E65E2=B2&C2&A2
F2:F64F2=IFERROR(AGGREGATE(15,6,ROW($E3:$E$65)/($E3:$E$65=B2*-1&C2&A2),COUNTIF($E$1:$E1,E2)+1),"")
G2:G65G2=IFERROR(IF(F2<>"","",MATCH(ROW(),$F$2:$F$65,0)+1),"")
F65F65=IFERROR(AGGREGATE(15,6,ROW($E$65:$E66)/($E$65:$E66=B65*-1&C65&A65),COUNTIF($E$1:$E64,E65)+1),"")
 
Upvote 0

Forum statistics

Threads
1,214,405
Messages
6,119,323
Members
448,887
Latest member
AirOliver

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