Spreadsheet: 734924d1622584463-max-if-wrong-result-max-if
Sheet: Sheet1

LAST DATE |  | CASH | CASH | MONEY | MONEY | PRICED | PRICED | PRICED | MARGIN | MARKET VALUE | MARKET VALUE
LAST AMOUNT |  | DATE | MAX | DATE | MAX | DATE | MAX | DATE | MAX | DATE | MAX
A | A
B | B
C | C
D | D
E | E
F | F
G | G
H | H
I | I
J | J
TOTAL | TOTAL |  |  |  |  |  |  |  |  |  |  | NO TOTALS
TOTAL LINE | SHOULD BE ==>> | 2021-05-27 00:00:00 | 87.17 | 2021-05-28 00:00:00 | 240055.96 | 2021-05-28 00:00:00 | 4510341.41 | 2021-05-28 00:00:00 |  | 2021-05-28 00:00:00 | 4750453.07
 | DATE | CODE A | CODE B | CODE C | CASH | MONEY | PRICED | MARGIN | MARKET
 | 2021-05-24 00:00:00 | A | A | A | 0 | 2000 | 35239.14 | 0 | 423000.99
 | 2021-05-24 00:00:00 | B | B | B | 0 | 2038.15 | 32110.16 | 0 | 34148.31
 | 2021-05-24 00:00:00 | C | C | C | 0 | 4337.64 | 675796.6 | 0 | 680134.24
 | 2021-05-24 00:00:00 | D | D | D | 0 | 2769.03 | 6720.4 | 0 | 9489.43
 | 2021-05-24 00:00:00 | E | E | E | 0 | 73264 | 2641361.18 | 0 | 2714625.38
 | 2021-05-24 00:00:00 | F | F | F | 0 | 2391 | 118714.11 | 0 | 121105.86
 | 2021-05-24 00:00:00 | G | G | G | 0 | 142028.21 | 667083.68 | 0 | 809111.89
 | 2021-05-24 00:00:00 | H | H | H | 0 | 9269.21 | 126655.83 | 0 | 135925.04
 | 2021-05-24 00:00:00 | I | I | C | 0 | 395.26 | 108623.68 | 0 | 109018.94
 | 2021-05-24 00:00:00 | J | J | I | 0 | 58.96 | 75111.34 | 0 | 75170.3
 | 2021-05-24 00:00:00 | TOTAL | TOTAL | TOTAL | 0 | 239962.93 | 4493095.42 | 0 | 4733059.3
 | 2021-05-25 00:00:00 | A | A | A | 0 | 3411.47 | 40890.88 | 0 | 44302.35
 | 2021-05-25 00:00:00 | B | B | B | 0 | 2038.15 | 32107.62 | 0 | 34145.77
 | 2021-05-25 00:00:00 | C | C | C | 0 | 4337.64 | 674873.82 | 0 | 679211.46
 | 2021-05-25 00:00:00 | D | D | D | 0 | 2769.03 | 6706.63 | 0 | 9475.66
 | 2021-05-25 00:00:00 | E | E | E | 0.2 | 73264 | 2618872.8 | 0 | 2692137
 | 2021-05-25 00:00:00 | F | F | F | 0.75 | 2391 | 118487.77 | 0 | 120879.52
 | 2021-05-25 00:00:00 | G | G | G | 0 | 142028.21 | 660818.09 | 0 | 802846.3
 | 2021-05-25 00:00:00 | H | H | H | 5.22 | 9269.21 | 126810.78 | 0 | 136085.21
 | 2021-05-25 00:00:00 | I | I | I | 0 | 395.26 | 107941.84 | 0 | 108337.1
 | 2021-05-25 00:00:00 | J | J | J | 0 | 58.96 | 74633.55 | 0 | 74692.51
 | 2021-05-25 00:00:00 | TOTAL | TOTAL | TOTAL | 6.17 | 239962.93 | 4462143.78 | 0 | 4702112.88
 | 2021-05-26 00:00:00 | A | A | A | 0 | 3411.47 | 41016.81 | 0 | 44428.28
 | 2021-05-26 00:00:00 | B | B | B | 0 | 2038.15 | 32149.39 | 0 | 34187.54
 | 2021-05-26 00:00:00 | C | C | C | 0 | 4337.64 | 676288.77 | 0 | 680626.41
 | 2021-05-26 00:00:00 | D | D | D | 0 | 2769.03 | 6738.86 | 0 | 9507.89
 | 2021-05-26 00:00:00 | E | E | E | 0.2 | 73264 | 2627371.48 | 0 | 2700635.68
 | 2021-05-26 00:00:00 | F | F | F | 0.75 | 2391 | 118777.42 | 0 | 121169.17
 | 2021-05-26 00:00:00 | G | G | G | 0 | 142028.21 | 661602.45 | 0 | 803630.66
 | 2021-05-26 00:00:00 | H | H | H | 0 | 9274.43 | 127175.5 | 0 | 136449.93
 | 2021-05-26 00:00:00 | I | I | I | 0 | 395.26 | 108252.31 | 0 | 108647.57
 | 2021-05-26 00:00:00 | J | J | J | 0 | 58.96 | 74615.13 | 0 | 74674.09
 | 2021-05-26 00:00:00 | TOTAL | TOTAL | TOTAL | 0.95 | 239968.15 | 4473988.12 | 0 | 4713957.22
 | 2021-05-27 00:00:00 | A | A | TOTAL | 0 | 3411.47 | 41065.32 | 0 | 44476.79
 | 2021-05-27 00:00:00 | B | B | B | 1.14 | 2038.15 | 32179.94 | 0 | 34219.23
 | 2021-05-27 00:00:00 | C | C | C | 40.32 | 4337.64 | 677545.96 | 0 | 681923.92
 | 2021-05-27 00:00:00 | D | D | D | 0 | 2769.03 | 6755.84 | 0 | 9524.87
 | 2021-05-27 00:00:00 | E | E | E | 0.2 | 73264 | 2651256.06 | 0 | 2724520.26
 | 2021-05-27 00:00:00 | F | F | F | 12.63 | 2391 | 119072.17 | 0 | 121475.8
 | 2021-05-27 00:00:00 | G | G | G | 0 | 142028.21 | 667798.24 | 0 | 809826.45
 | 2021-05-27 00:00:00 | H | H | H | 32.88 | 9274.43 | 127623.14 | 0 | 136930.45
 | 2021-05-27 00:00:00 | I | I | I | 0 | 395.26 | 108169.99 | 0 | 108565.25
 | 2021-05-27 00:00:00 | J | J | J | 0 | 58.96 | 74826.89 | 0 | 74885.85
 | 2021-05-27 00:00:00 | TOTAL | TOTAL | TOTAL | 87.17 | 239968.15 | 4506293.55 | 0 | 4746348.87
 | 2021-05-28 00:00:00 | A | A | A | 0 | 3411.5 | 41111.93 | 0 | 44523.43
 | 2021-05-28 00:00:00 | B | B | B | 0 | 2039.31 | 32189.62 | 0 | 34228.93
 | 2021-05-28 00:00:00 | C | C | C | 0 | 4378 | 678380.52 | 0 | 682758.52
 | 2021-05-28 00:00:00 | D | D | D | 0 | 2769.05 | 6770.91 | 0 | 9539.96
 | 2021-05-28 00:00:00 | E | E | E | 52.88 | 73264 | 2653117.54 | 0 | 2726434.42
 | 2021-05-28 00:00:00 | F | F | F | 0.66 | 2403 | 119237.8 | 0 | 121641.46
 | 2021-05-28 00:00:00 | G | G | G | 0 | 142029.52 | 668990.53 | 0 | 811020.05
 | 2021-05-28 00:00:00 | H | H | H | 2.16 | 9307.36 | 128069.38 | 0 | 137378.9
 | 2021-05-28 00:00:00 | I | I | I | 0 | 395.26 | 107853.46 | 0 | 108248.72
 | 2021-05-28 00:00:00 | J | J | J | 0 | 58.96 | 74619.72 | 0 | 74678.68
 | 2021-05-28 00:00:00 | TOTAL | TOTAL | TOTAL | 55.7 | 240055.96 | 4510341.41 | 0 | 4750453.07