Spreadsheet: 863649d1711054898-formula-to-subtotal-values-based-on-multiple-criteria-example-data-with-formulas
Sheet: Example Data

Type | Invoice# | Date Sold | Product ID | Trade | Trade STE | GM | GM% | AGMNT |  | LET(f,FILTER(B3:B39,F3:F39="Not Loaded"),SUM(BYROW(f,LAMBDA(r,SUMIF(B3:B39,r,G3:G39)))))
Used | 5617567 | 2024-02-15 00:00:00 | 1039133 |  |  | 3950 | 0.0195 | $         - |  | Result:
New | 5617537 | 2024-02-15 00:00:00 | 353470 |  |  | 7672.08 | 0.1311 | $         -
New | 5617558 | 2024-02-15 00:00:00 | 350402 |  |  | 1788.47 | 0.0727 | $         - |  | LET(f,FILTER(B3:B39,F3:F39="Not Loaded"),HSTACK(f,BYROW(f,LAMBDA(r,SUMIF(B3:B39,r,G3:G39)))))
New | 5617558 | 2024-02-15 00:00:00 | 350816 | 1039242 | Not Loaded | 9360.19 | 0.0736 | $         - |  | Result: |  | 34607.27
New | 5617558 | 2024-02-15 00:00:00 | 350401 |  |  | 12044.12 | 0.0339 | $         - |  |  | 5607109 | 3389.15
New | 5617574 | 2024-02-15 00:00:00 | 342146 |  |  | 805.02 | 0.0969 | $         - |  |  | 5606724 | 1818.79
New | 5617558 | 2024-02-15 00:00:00 | 350397 | 1039133 |  | 11414.49 | 0.022 | $         - |  |  | 5606662 | 529.95
New | 5617971 | 2024-02-15 00:00:00 | 355595 |  |  | 861.92 | 0.1326 | $         - |  |  | 5603638 | 3345.12
New | 5607276 | 2024-02-01 00:00:00 | 357231 |  |  | 2798 | 0.1003 | $         - |  |  | 5603152 | 3372.64
New | 5607109 | 2024-01-31 00:00:00 | 351606 |  |  | 3052.44 | 0.1135 | $         - |  |  | 5596717 | 617.8100000000001
New | 5607109 | 2024-01-31 00:00:00 | 351605 | 1039264 | Not Loaded | 336.71 | 0.0125 | $         -
New | 5607074 | 2024-01-31 00:00:00 | 342967 | 1039254 |  | 887.74 | 0.074 | $         - |  | [NAME]"))
New | 5607072 | 2024-01-31 00:00:00 | 350354 |  |  | 3387.95 | 0.1189 | $         - |  | Result:
New | 5607070 | 2024-01-31 00:00:00 | 341332 |  |  | 823.46 | 0.071 | $         -
New | 5606782 | 2024-01-31 00:00:00 | 344628 |  |  | 99.81 | 0.1597 | $         - |  | SUM(IF(ISNUMBER(XMATCH(B3:B39,FILTER(B3:B39,F3:F39="Not Loaded"))),MAP(G3:G39,LAMBDA(g,SUBTOTAL(9,g))),))
New | 5606734 | 2024-01-31 00:00:00 | 356094 |  |  | 102.25 | 0.1203 | $         - |  | Result:
Used | 5606724 | 2024-01-31 00:00:00 | 1038779 | 1039253 | Not Loaded | 1818.79 | 0.0353 | $         -
Used | 5606722 | 2024-01-31 00:00:00 | 1038600 |  |  | 1435.63 | 0.0122 | $         - |  | SUM(IF(ISNUMBER(XMATCH(B3:B39,FILTER(B3:B39,F3:F39="Not Loaded"))),MAP(G3:G39,LAMBDA(g,SUBTOTAL(9,g))),))
New | 5606713 | 2024-01-31 00:00:00 | 355723 |  |  | 252.41 | 0.2103 | $         - |  | Result:
Used | 5606662 | 2024-01-31 00:00:00 | 1038159 | 1038978 | Not Loaded | 529.95 | 0.0321 | $         -
New | 5606642 | 2024-01-31 00:00:00 | 351584 |  |  | 502.83 | 0.0739 | $         - |  | SUM(SUMIFS(G3:G38,B3:B38,FILTER(B3:B38,F3:F38="Not Loaded")))
Used | 5603703 | 2024-01-26 00:00:00 | 1031042 |  |  | 267.07 | 0.178 | $         - |  | Result:
New | 5603692 | 2024-01-26 00:00:00 | 343710 |  |  | 1194.17 | 0.0412 | $   697.00
New | 5603638 | 2024-01-26 00:00:00 | 318300 |  |  | 200 | 0.277 | $         -
Used | 5603638 | 2024-01-26 00:00:00 | 1038987 | 10392191039220 | Not Loaded | 2368.12 | 0.0474 | $         -
New | 5603638 | 2024-01-26 00:00:00 | 301735 |  |  | 777 | 0.9987 | $         -
Used | 5603632 | 2024-01-26 00:00:00 | 1036646 |  |  | 2738.74 | 0.2883 | $         -
New | 5603166 | 2024-01-25 00:00:00 | 345726 |  |  | 2230.41 | 0.1716 | $         -
New | 5603160 | 2024-01-25 00:00:00 | 355727 |  |  | 4573.7 | 0.1307 | $         -
New | 5603152 | 2024-01-25 00:00:00 | 333590 | 1039231 | Not Loaded | 2886 | 0.0411 | $         -
New | 5603152 | 2024-01-25 00:00:00 | 337925 |  |  | 486.64 | 0.0559 | $         -
Used | 5596758 | 2024-01-11 00:00:00 | 1037585 |  |  | 9953.62 | 0.024 | $         -
New | 5596717 | 2024-01-11 00:00:00 | 350012 | 10386591038660 | Not Loaded | 847.47 | 0.1011 | $   716.00
New | 5596717 | 2024-01-11 00:00:00 | 350013 |  |  | -229.66 | -0.1699 | $         -
New | 5596707 | 2024-01-11 00:00:00 | 339992 |  |  | 444.4 | 0.2469 | $         -
New | 5596613 | 2024-01-10 00:00:00 | 337963 |  |  | 2478.98 | 0.0472 | $         -
Total