Spreadsheet: 863602d1711021020-formula-to-subtotal-values-based-on-multiple-criteria-example-data
Sheet: Example Data

EXAMPLE DATA
Type | Invoice # | Date Sold | Product ID | Trade | Trade STE | GM | GM% | AGMNT
New | 5618089 | 2024-02-15 00:00:00 | 355391 |  |  | 258.12 | 0.1475 | 0
Used | 5617567 | 2024-02-15 00:00:00 | 1039133 |  |  | 3950 | 0.0195 | 0
New | 5617537 | 2024-02-15 00:00:00 | 353470 |  |  | 7672.08 | 0.1311 | 0
New | 5617558 | 2024-02-15 00:00:00 | 350402 |  |  | 1788.47 | 0.0727 | 0
New | 5617558 | 2024-02-15 00:00:00 | 350816 | 1039242 | Not Loaded | 9360.19 | 0.0736 | 0
New | 5617558 | 2024-02-15 00:00:00 | 350401 |  |  | 12044.12 | 0.0339 | 0
New | 5617574 | 2024-02-15 00:00:00 | 342146 |  |  | 805.02 | 0.0969 | 0
New | 5617558 | 2024-02-15 00:00:00 | 350397 | 1039133 |  | 11414.49 | 0.022 | 0
New | 5617971 | 2024-02-15 00:00:00 | 355595 |  |  | 861.92 | 0.1326 | 0
New | 5607276 | 2024-02-01 00:00:00 | 357231 |  |  | 2798 | 0.1003 | 0
New | 5607109 | 2024-01-31 00:00:00 | 351606 |  |  | 3052.44 | 0.1135 | 0
New | 5607109 | 2024-01-31 00:00:00 | 351605 | 1039264 | Not Loaded | 336.71 | 0.0125 | 0
New | 5607074 | 2024-01-31 00:00:00 | 342967 | 1039254 |  | 887.74 | 0.074 | 0
New | 5607072 | 2024-01-31 00:00:00 | 350354 |  |  | 3387.95 | 0.1189 | 0
New | 5607070 | 2024-01-31 00:00:00 | 341332 |  |  | 823.46 | 0.071 | 0
New | 5606782 | 2024-01-31 00:00:00 | 344628 |  |  | 99.81 | 0.1597 | 0
New | 5606734 | 2024-01-31 00:00:00 | 356094 |  |  | 102.25 | 0.1203 | 0
Used | 5606724 | 2024-01-31 00:00:00 | 1038779 | 1039253 | Not Loaded | 1818.79 | 0.0353 | 0
Used | 5606722 | 2024-01-31 00:00:00 | 1038600 |  |  | 1435.63 | 0.0122 | 0
New | 5606713 | 2024-01-31 00:00:00 | 355723 |  |  | 252.41 | 0.2103 | 0
Used | 5606662 | 2024-01-31 00:00:00 | 1038159 | 1038978 | Not Loaded | 529.95 | 0.0321 | 0
New | 5606642 | 2024-01-31 00:00:00 | 351584 |  |  | 502.83 | 0.0739 | 0
Used | 5603703 | 2024-01-26 00:00:00 | 1031042 |  |  | 267.07 | 0.178 | 0
New | 5603692 | 2024-01-26 00:00:00 | 343710 |  |  | 1194.17 | 0.0412 | 697
New | 5603638 | 2024-01-26 00:00:00 | 318300 |  |  | 200 | 0.277 | 0
Used | 5603638 | 2024-01-26 00:00:00 | 1038987 | 10392191039220 | Not Loaded | 2368.12 | 0.0474 | 0
New | 5603638 | 2024-01-26 00:00:00 | 301735 |  |  | 777 | 0.9987 | 0
Used | 5603632 | 2024-01-26 00:00:00 | 1036646 |  |  | 2738.74 | 0.2883 | 0
New | 5603166 | 2024-01-25 00:00:00 | 345726 |  |  | 2230.41 | 0.1716 | 0
New | 5603160 | 2024-01-25 00:00:00 | 355727 |  |  | 4573.7 | 0.1307 | 0
New | 5603152 | 2024-01-25 00:00:00 | 333590 | 1039231 | Not Loaded | 2886 | 0.0411 | 0
New | 5603152 | 2024-01-25 00:00:00 | 337925 |  |  | 486.64 | 0.0559 | 0
Used | 5596758 | 2024-01-11 00:00:00 | 1037585 |  |  | 9953.62 | 0.024 | 0
New | 5596717 | 2024-01-11 00:00:00 | 350012 | 10386591038660 | Not Loaded | 847.47 | 0.1011 | 716
New | 5596717 | 2024-01-11 00:00:00 | 350013 |  |  | -229.66 | -0.1699 | 0
New | 5596707 | 2024-01-11 00:00:00 | 339992 |  |  | 444.4 | 0.2469 | 0
New | 5596613 | 2024-01-10 00:00:00 | 337963 |  |  | 2478.98 | 0.0472 | 0
 |  |  |  |  |  | Total GM for invoices with Trade STE "Not Loaded"
 |  |  |  |  |  | Should = | 36266.24
 |  |  |  |  |  |  |  |  |  |  | 34607.27
 |  |  |  |  |  |  |  |  |  | 5607109 | 3389.15
 |  |  |  |  |  |  |  |  |  | 5606724 | 1818.79
 |  |  |  |  |  |  |  |  |  | 5606662 | 529.95
 |  |  |  |  |  |  |  |  |  | 5603638 | 3345.12
 |  |  |  |  |  |  |  |  |  | 5603152 | 3372.64
 |  |  |  |  |  |  |  |  |  | 5596717 | 617.8100000000001
 |  |  |  |  |  |  |  |  |  | Sum
 |  |  |  |  |  |  |  |  |  | Difference
 |  |  |  |  |  |  |  |  |  |  | Result | Length | [NAME]
 |  |  |  |  |  |  |  |  |  | TMS
 |  |  |  |  |  |  |  |  |  | ExceLogan
 |  |  |  |  |  |  |  |  |  | wk9128