Finding Invoices Paid Out of Order

Elliottj2121

Board Regular
Joined
Apr 15, 2021
Messages
56
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,

I am hoping someone can help me. I have a basic understanding of VBA and formulas but this problem is stumping me. I am trying to have excel find the invoices that are paid out of order by invoice date. In the condensed example below Alpha Company skipped the invoice from 10/10/2022 and 10/24/2022. However, the invoices between rows 14-16 are not skipped because there are no newer invoices paid after row 13. Beta Company did not skip any invoices. What I would like is to run a macro (or use formulas with sorting) that only would show the skipped invoices, i.e. the rows in yellow. Each company has a unique customer number, my spreadsheet has thousands of rows and the number of rows can vary day to day.

Thank you!!!

SKIP_RPT_EX.xlsx
ABCDEFGHI
1CUST #CUST NAMEINVOICE NUMBERINV DATEPAID DATEOPEN AMTPAY DAY OF YEARINVOICE DAY OF YEARPAID=1 OPEN=-1
21375ALPHA46810/09/202211/03/2022189.05307283-1
31375ALPHA47110/10/2022NULL189.050283-1
41375ALPHA94410/11/202211/03/20220.003072841
51375ALPHA57910/19/202211/03/20220.003072921
61375ALPHA6810/20/202211/03/20220.003072931
71375ALPHA74410/24/202211/03/20220.003072971
81375ALPHA4110/24/202211/03/20220.003072971
91375ALPHA36310/24/2022NULL346.730297-1
101375ALPHA50410/24/202211/03/20220.003072971
111375ALPHA95510/31/202211/03/20220.003073041
121375ALPHA44710/31/202211/03/20220.003073041
131375ALPHA32710/31/202211/03/20220.003073041
141375ALPHA15111/01/2022NULL1197.340305-1
151375ALPHA15311/01/2022NULL21511.830305-1
161375ALPHA15011/02/2022NULL693.450306-1
171200BETA67808/29/202211/03/20220.003072411
181200BETA11908/29/202211/03/20220.003072411
191200BETA91108/29/202211/03/20220.003072411
201200BETA52609/21/2022NULL10621.700264-1
211200BETA86109/21/2022NULL3829.190264-1
221200BETA95709/22/2022NULL10291.680265-1
231200BETA24009/26/2022NULL2252.560269-1
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C:CCell ValueduplicatestextNO
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hello

Just seeing if anyone can give me a hand with this problem. Much appreciated!
 
Upvote 0
@Elliottj2121 As you have XL365 can you use something like below?
It is requiring a helper column.

Book2
ABCDEFGHIJKLMN
1CUST #CUST NAMEINVOICE NUMBERINV DATEPAID DATEOPEN AMTPAY DAY OF YEARINVOICE DAY OF YEARPAID=1 OPEN=-1Helper
21375ALPHA4689/10/223/11/22189.0504307283113CUST #CUST NAMEINVOICE NUMBER
31375ALPHA47110/10/22NULL189.05040283-1131375ALPHA471
41375ALPHA94411/10/223/11/2203072841131375ALPHA363
51375ALPHA57910/19/20223/11/220307292113
61375ALPHA6810/20/20223/11/220307293113
71375ALPHA74410/24/20223/11/220307297113
81375ALPHA4110/24/20223/11/220307297113
91375ALPHA36310/24/2022NULL346.72680297-113
101375ALPHA50410/24/20223/11/220307297113
111375ALPHA95510/31/20223/11/220307304113
121375ALPHA44710/31/20223/11/220307304113
131375ALPHA32710/31/20223/11/220307304113
141375ALPHA1511/11/22NULL1197.34440305-113
151375ALPHA1531/11/22NULL21511.82880305-113
161375ALPHA1502/11/22NULL693.45360306-113
171200BETA67808/29/20223/11/220307241119
181200BETA11908/29/20223/11/220307241119
191200BETA91108/29/20223/11/220307241119
201200BETA52609/21/2022NULL10621.69920264-119
211200BETA86109/21/2022NULL3829.19040264-119
221200BETA95709/22/2022NULL10291.680265-119
231200BETA24009/26/2022NULL2252.56080269-119
Sheet5
Cell Formulas
RangeFormula
L2:N4L2=FILTER(A:C,(I:I<>1)*(ROW(I:I)<J:J))
J2:J23J2=MAX((I:I=1)*ROW(I:I)*(A:A=A2))
Dynamic array formulas.


Hope that helps.
 
Upvote 0
I am unsure whether you wanted those invoices highlighted like in post #1 or listed as Tony has done or something else. Anyway, here are a couple more possible options for you. I would avoid using whole column references if possible.

Elliottj2121.xlsm
ABCDEFGHIJKLMNOPQRST
1CUST #CUST NAMEINVOICE NUMBERINV DATEPAID DATEOPEN AMTPAY DAY OF YEARINVOICE DAY OF YEARPAID=1 OPEN=-1CUST #CUST NAMEINVOICE NUMBERINV DATEPAID DATEOPEN AMTPAY DAY OF YEARINVOICE DAY OF YEARPAID=1 OPEN=-1
21375ALPHA4689/10/20223/11/2022189.0504307283-11375ALPHA47110/10/2022NULL189.05040283-1
31375ALPHA47110/10/2022NULL189.05040283-11375ALPHA36324/10/2022NULL346.72680297-1
41375ALPHA94411/10/20223/11/202203072841
51375ALPHA57919/10/20223/11/202203072921
61375ALPHA6820/10/20223/11/202203072931
71375ALPHA74424/10/20223/11/202203072971
81375ALPHA4124/10/20223/11/202203072971
91375ALPHA36324/10/2022NULL346.72680297-1
101375ALPHA50424/10/20223/11/202203072971
111375ALPHA95531/10/20223/11/202203073041
121375ALPHA44731/10/20223/11/202203073041
131375ALPHA32731/10/20223/11/202203073041
141375ALPHA1511/11/2022NULL1197.34440305-1
151375ALPHA1531/11/2022NULL21511.82880305-1
161375ALPHA1502/11/2022NULL693.45360306-1
171200BETA67829/08/20223/11/202203072411
181200BETA11929/08/20223/11/202203072411
191200BETA91129/08/20223/11/202203072411
201200BETA52621/09/2022NULL10621.69920264-1
211200BETA86121/09/2022NULL3829.19040264-1
221200BETA95722/09/2022NULL10291.680265-1
231200BETA24026/09/2022NULL2252.56080269-1
Sheet1
Cell Formulas
RangeFormula
L2:T3L2=FILTER(A2:I9999,(E2:E9999="NULL")*(COUNTIFS(B2:B9999,B2:B9999,D2:D9999,">"&D2:D9999,I2:I9999,1)))
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:I23Expression=AND($E2="NULL",COUNTIFS($B$2:$B$9999,$B2,$D$2:$D$9999,">"&$D2,$I$2:$I$9999,1))textNO
 
Upvote 0
I am unsure whether you wanted those invoices highlighted like in post #1 or listed as Tony has done or something else. Anyway, here are a couple more possible options for you. I would avoid using whole column references if possible.

Elliottj2121.xlsm
ABCDEFGHIJKLMNOPQRST
1CUST #CUST NAMEINVOICE NUMBERINV DATEPAID DATEOPEN AMTPAY DAY OF YEARINVOICE DAY OF YEARPAID=1 OPEN=-1CUST #CUST NAMEINVOICE NUMBERINV DATEPAID DATEOPEN AMTPAY DAY OF YEARINVOICE DAY OF YEARPAID=1 OPEN=-1
21375ALPHA4689/10/20223/11/2022189.0504307283-11375ALPHA47110/10/2022NULL189.05040283-1
31375ALPHA47110/10/2022NULL189.05040283-11375ALPHA36324/10/2022NULL346.72680297-1
41375ALPHA94411/10/20223/11/202203072841
51375ALPHA57919/10/20223/11/202203072921
61375ALPHA6820/10/20223/11/202203072931
71375ALPHA74424/10/20223/11/202203072971
81375ALPHA4124/10/20223/11/202203072971
91375ALPHA36324/10/2022NULL346.72680297-1
101375ALPHA50424/10/20223/11/202203072971
111375ALPHA95531/10/20223/11/202203073041
121375ALPHA44731/10/20223/11/202203073041
131375ALPHA32731/10/20223/11/202203073041
141375ALPHA1511/11/2022NULL1197.34440305-1
151375ALPHA1531/11/2022NULL21511.82880305-1
161375ALPHA1502/11/2022NULL693.45360306-1
171200BETA67829/08/20223/11/202203072411
181200BETA11929/08/20223/11/202203072411
191200BETA91129/08/20223/11/202203072411
201200BETA52621/09/2022NULL10621.69920264-1
211200BETA86121/09/2022NULL3829.19040264-1
221200BETA95722/09/2022NULL10291.680265-1
231200BETA24026/09/2022NULL2252.56080269-1
Sheet1
Cell Formulas
RangeFormula
L2:T3L2=FILTER(A2:I9999,(E2:E9999="NULL")*(COUNTIFS(B2:B9999,B2:B9999,D2:D9999,">"&D2:D9999,I2:I9999,1)))
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:I23Expression=AND($E2="NULL",COUNTIFS($B$2:$B$9999,$B2,$D$2:$D$9999,">"&$D2,$I$2:$I$9999,1))textNO

I get a #CALC! error with the fist formula.
 
Upvote 0
I get a #CALC! error with the fist formula.
Do you mean the L2 formula?
Test by starting a blank worksheet and copy my mini sheet using this icon:
1667736448994.png


and paste into cell A1 of the blank worksheet. Does that produce the results shown in my mini sheet?
 
Upvote 0
Do you mean the L2 formula?
Test by starting a blank worksheet and copy my mini sheet using this icon: View attachment 77951

and paste into cell A1 of the blank worksheet. Does that produce the results shown in my mini sheet?

Yes with the L2 formula and I did what you suggested first. I'm guessing since my actual data set is around 30,000 rows I need to use the is_blank argument.

Also I can't seem to get the conditional formatting right.
 
Upvote 0
Yes with the L2 formula and I did what you suggested first.
Did that work for the smaller sample size?

I'm guessing since my actual data set is around 30,000 rows I need to use the is_blank argument.
Can you explain why you would need is blank and where you would need it?

Also I can't seem to get the conditional formatting right.
So, are you looking for the "conditional formatting method" (results could be scattered d throughout 30,000 rows) or are you looking for the "list method" where all the results would be listed together?
 
Upvote 0
Did that work for the smaller sample size?


Can you explain why you would need is blank and where you would need it?


So, are you looking for the "conditional formatting method" (results could be scattered d throughout 30,000 rows) or are you looking for the "list method" where all the results would be listed together?

I would prefer the highlighted method so it can be used with filter by color as that is most familiar with the staff that will be using it. A new list would be exported from the database daily and rows will vary.
 
Upvote 0
Sounds like the size of the data is causing some problems. In that case I suggest that you abandon the Conditional Formatting idea. Conditional Formatting is (super) volatile so will be placing more calculation burden on the workbook.

What about adding a helper column as I have done below in column J. Instead of filtering on colour, you can filter that column for 1.

If you really do want the CF then I have included a much simpler one in my mini sheet below using that extra column, but I don't think that really adds much over a 30,000 row data set. Anyway, you can try with/without the CF if you want.

Elliottj2121.xlsm
ABCDEFGHIJ
1CUST #CUST NAMEINVOICE NUMBERINV DATEPAID DATEOPEN AMTPAY DAY OF YEARINVOICE DAY OF YEARPAID=1 OPEN=-1Skipped
21375ALPHA4689/10/20223/11/2022189.0504307283-1 
31375ALPHA47110/10/2022NULL189.05040283-11
41375ALPHA94411/10/20223/11/202203072841 
51375ALPHA57919/10/20223/11/202203072921 
61375ALPHA6820/10/20223/11/202203072931 
71375ALPHA74424/10/20223/11/202203072971 
81375ALPHA4124/10/20223/11/202203072971 
91375ALPHA36324/10/2022NULL346.72680297-11
101375ALPHA50424/10/20223/11/202203072971 
111375ALPHA95531/10/20223/11/202203073041 
121375ALPHA44731/10/20223/11/202203073041 
131375ALPHA32731/10/20223/11/202203073041 
141375ALPHA1511/11/2022NULL1197.34440305-1 
151375ALPHA1531/11/2022NULL21511.82880305-1 
161375ALPHA1502/11/2022NULL693.45360306-1 
171200BETA67829/08/20223/11/202203072411 
181200BETA11929/08/20223/11/202203072411 
191200BETA91129/08/20223/11/202203072411 
201200BETA52621/09/2022NULL10621.69920264-1 
211200BETA86121/09/2022NULL3829.19040264-1 
221200BETA95722/09/2022NULL10291.680265-1 
231200BETA24026/09/2022NULL2252.56080269-1 
Sheet1 (2)
Cell Formulas
RangeFormula
J2:J23J2=IF(E2="NULL",IF(COUNTIFS(B$2:B$40000,B2,D$2:D$40000,">"&D2,I2:I40000,1),1,""),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:I23Expression=$J2textNO
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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