Unique with Sort but exluding rows

wildturkey

Board Regular
Joined
Feb 21, 2006
Messages
189
Office Version
  1. 365
Platform
  1. Windows
Morning All

I'm hoping someone could tweak the following to exclude people who are marked as 'Seas or DD' in colum H please - any pointers gratefully accepted :)

=LET(Uni,UNIQUE(G:G),Tot,SUMIFS(F:F,G:G,Uni),INDEX(SORT(CHOOSE({1,2},Uni,Tot),2,-1),SEQUENCE(MIN(ROWS(Uni),2000)),{1,2}))

Test Data.xlsx
ABCDEFGHIJKL
1Transaction TypeDateDocument NumberDue DateAgeOpen BalanceVendorDue DateDARREN99399.64
2Bill10/12/2023287310 SH10/12/202331589.96JAMIE31/01/2024ASHLEY9698.52
3Bill16/12/2023287569 SH16/12/202325709.66JAMIE31/01/2024HARRY9079.08
4Bill23/12/2023287787 SH23/12/202318721.36JAMIE31/01/2024RYAN7240.36
5Bill19/12/20231906531/01/2024-2172NATHAN31/01/2024JONATHAN7194
6Bill02/01/20246042702/01/20248132CARL29/02/2024EMILY6670.89
7Bill16/01/2024A102017876-012429/02/2024-506670.89EMILY29/02/2024LAURA4917.22
8Bill12/12/20232023A1/157329/02/2024-501425.6CONNOR31/01/2024BRADLEY4582.73
9Bill07/12/20231000607/12/2023347194JONATHAN31/01/2024CALLUM3810.43
10Bill01/01/20248400648701/01/2024927LAURASeas or DDEMMA3563.25
11Bill01/01/20248400617201/01/2024960LAURASeas or DDAARON3044.22
12Bill01/01/20248400629601/01/2024960LAURASeas or DDJAMIE2020.98
13Bill01/01/20248400648801/01/20249162LAURASeas or DDCONNOR1425.6
14Bill01/01/20248400649001/01/20249135LAURASeas or DDCARL132
15Bill01/01/20248400648901/01/20249279LAURASeas or DDNATHAN72
16Bill01/01/20248400649101/01/2024999LAURASeas or DDVendor0
17Bill01/01/20248400648301/01/2024972LAURASeas or DD00
18Bill02/01/20248400836402/01/202481035.79LAURASeas or DD
19Bill02/01/20248400836502/01/20248538.25LAURASeas or DD
20Bill02/01/20248400802502/01/20248382.16LAURASeas or DD
21Bill02/01/20248400835302/01/20248772.7LAURASeas or DD
22Bill02/01/20248400836302/01/202481308.77LAURASeas or DD
23Bill Credit09/01/20248401194009/01/20241-51LAURASeas or DD
24Bill09/01/20248401174709/01/2024160.55LAURASeas or DD
25Bill Credit09/01/20248401187609/01/20241-24LAURASeas or DD
26Bill18/12/202322794818/12/20232379.08HARRY31/01/2024
27Bill19/12/2023200170519/12/2023229000HARRY31/01/2024
28Bill01/12/2023499531/01/2024-21286.49CALLUM31/01/2024
29Bill01/12/2023499631/01/2024-211796.62CALLUM31/01/2024
30Bill08/12/2023502531/01/2024-21363.48CALLUM31/01/2024
31Bill15/12/2023506331/01/2024-211030.62CALLUM31/01/2024
32Bill04/01/2024509629/02/2024-50324.82CALLUM29/02/2024
33Bill05/01/2024510629/02/2024-508.4CALLUM29/02/2024
34Bill06/02/2024526132318-022406/02/2024-273563.25EMMASeas or DD
35Bill31/12/2023INV-1031030/01/2024-203044.22AARON31/01/2024
36Bill16/11/2023INV-124816/11/2023554439.3RYAN31/12/2023
37Bill24/11/2023INV-125224/11/2023472657.06RYAN31/12/2023
38Bill12/12/2023INV-127212/12/202329144RYAN31/01/2024
39Bill07/01/202010752 201707/01/2020###32985.28DARRENSeas or DD
40Bill08/02/202111167 201708/02/2021###31055.39DARRENSeas or DD
41Bill21/04/202110825 201821/04/202199435358.97DARRENSeas or DD
42Bill13/12/20232186213/12/2023283476.43ASHLEY31/01/2024
43Bill19/12/20232188619/12/2023222640.95ASHLEY31/01/2024
44Bill27/12/20232190327/12/2023143581.14ASHLEY31/01/2024
45Bill28/12/20232.023E+1128/12/2023132955.88BRADLEY31/01/2024
46Bill28/12/20232.023E+1128/12/2023131626.85BRADLEY31/01/2024
47
report624
Cell Formulas
RangeFormula
K1:L17K1=LET(Uni,UNIQUE(G:G),Tot,SUMIFS(F:F,G:G,Uni),INDEX(SORT(CHOOSE({1,2},Uni,Tot),2,-1),SEQUENCE(MIN(ROWS(Uni),2000)),{1,2}))
E2E2=31
F2F2=589.96
E3E3=25
F3F3=709.66
E4E4=18
F4F4=721.36
E5,E28:E31E5=-21
F5,F17F5=72
E6,E18:E22E6=8
F6F6=132
E7:E8,E32:E33E7=-50
F7F7=6670.89
F8F8=1425.6
E9E9=34
F9F9=7194
E10:E17E10=9
F10F10=27
F11:F12F11=60
F13F13=162
F14F14=135
F15F15=279
F16F16=99
F18F18=1035.79
F19F19=538.25
F20F20=382.16
F21F21=772.7
F22F22=1308.77
E23:E25E23=1
F23F23=-51
F24F24=60.55
F25F25=-24
E26E26=23
F26F26=79.08
E27,E43E27=22
F27F27=9000
F28F28=286.49
F29F29=1796.62
F30F30=363.48
F31F31=1030.62
F32F32=324.82
F33F33=8.4
E34E34=-27
F34F34=3563.25
E35E35=-20
F35F35=3044.22
E36E36=55
F36F36=4439.3
E37E37=47
F37F37=2657.06
E38E38=29
F38F38=144
E39E39=1464
F39F39=32985.28
E40E40=1066
F40F40=31055.39
E41E41=994
F41F41=35358.97
E42E42=28
F42F42=3476.43
F43F43=2640.95
E44E44=14
F44F44=3581.14
E45:E46E45=13
F45F45=2955.88
F46F46=1626.85
Dynamic array formulas.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Twigged sorry

=LET(Uni,UNIQUE(FILTER(G:G,H:H<>"seas or DD")),Tot,SUMIFS(F:F,G:G,Uni),INDEX(SORT(CHOOSE({1,2},Uni,Tot),2,-1),SEQUENCE(MIN(ROWS(Uni),2000)),{1,2}))
 
Upvote 0
As you have 365 you could also use this, which will return the header of a blank row
Excel Formula:
=LET(Uni,UNIQUE(FILTER(G2:G10000,(H2:H10000<>"seas or DD")*(G2:G10000<>""))),Tot,SUMIFS(F:F,G:G,Uni),TAKE(SORT(HSTACK(Uni,Tot),2,-1),2000))
 
Upvote 0
Solution
As you have 365 you could also use this, which will return the header of a blank row
Excel Formula:
=LET(Uni,UNIQUE(FILTER(G2:G10000,(H2:H10000<>"seas or DD")*(G2:G10000<>""))),Tot,SUMIFS(F:F,G:G,Uni),TAKE(SORT(HSTACK(Uni,Tot),2,-1),2000))
And that does tidy it up nicely thank you!!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,114
Members
452,302
Latest member
TaMere

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