Spreadsheet: 150385d1334496942-when-2-columns-meet-criteria-find-the-max-in-another-column-and-subtract-from-another-col-example4
Sheet: TOTALS

WANT F5 TO = THE RESULTS WHEN (SHEET 2012_V COL "F:F"=165 & COL "N:N"=main then FIND THE MAX NUMBER IN COL "D:D") |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | WANT F5 TO = THE RESULTS WHEN (SHEET 2012_V COL "F"=165 & COL "N"=1 FIND THE MAX NUMBER IN COL "D")
THEN SUBTRACT "AF5" ON THIS SHEET)  ANSWER SHOULD BE 13 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | THEN SUBTRACT "AF5" ON THIS SHEET)  ANSWER SHOULD BE 13
G R O U P | C L A S S | S O U R C E | S A L E S | T1 | WKS | YEAR | CUST # |  | BANK |  |  | AVER WEEK | AVER MONTH | [NAME] | [NAME] 2 | [NAME] 3 | [NAME] 4 | TOTAL | JAN | FEB | MAR | APR | MAY | JUN | JUL | AUG | SEP | OCT | NOV | DEC |  | S WK
 |  |  |  |  |  | 2012 | 165 |  | 1 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1
 |  |  |  |  |  | 2012 | 165 |  | 1
 |  |  |  |  |  | 2012 | 165 |  | 3
 |  |  |  | T1 |  | 2012 | 165 |  | company
 |  |  |  |  |  | 2012 | 147
 |  |  |  |  |  | 2012 | 147
 |  |  |  |  |  | 2012 | 147
 |  |  |  | T1 |  | 2012 | 147
 |  |  |  |  |  | 2012 | 146 |  | main
 |  |  |  |  |  | 2012 | 146 |  | main
 |  |  |  |  |  | 2012 | 146 |  | main
 |  |  |  | TS |  | 2012 | 146 |  | main
 |  |  |  |  |  | 2012 | 146 |  | 2
 |  |  |  |  |  | 2012 | 146 |  | 2
 |  |  |  | TS |  | 2012 | 146 |  | 2
 |  |  |  |  |  | 2012 | 146 |  | 4
 |  |  |  |  |  | 2012 | 146 |  | 4
 |  |  |  | TS |  | 2012 | 146 |  | 4
 |  |  |  |  |  | 2012 | 146 |  | 5
 |  |  |  | TS |  | 2012 | 146 |  | 5
 |  |  |  |  |  | 2012 | 146 |  | 6
 |  |  |  |  |  | 2012 | 146 |  | 6
 |  |  |  | TS |  | 2012 | 146 |  | 6
 |  |  |  |  |  | 2012 | 146 |  | company
 |  |  |  |  |  | 2012 | 146 |  | company
 |  |  |  |  |  | 2012 | 146 |  | company
 |  |  |  | TM |  | 2012 | 146 |  | company
 |  |  |  |  |  | 2012 | 153
 |  |  |  |  |  | 2012 | 153
 |  |  |  | T1 |  | 2012 | 153
 |  |  |  |  |  | 2012 | 136 |  | 400
 |  |  |  |  |  | 2012 | 136 |  | 400
 |  |  |  |  |  | 2012 | 136 |  | 400
 |  |  |  | T1 |  | 2012 | 136 |  | 400
 |  |  |  |  |  | 2012 | 136 |  | shop
 |  |  |  |  |  | 2012 | 136 |  | shop
 |  |  |  | T1 |  | 2012 | 136 |  | shop
 |  |  |  |  |  | 2012 | 136 |  | main
 |  |  |  |  |  | 2012 | 136 |  | main
 |  |  |  |  |  | 2012 | 136 |  | main
 |  |  |  |  |  | 2012 | 136. |  | main
 |  |  |  | T1 |  | 2012 | 136 |  | main
 |  |  |  |  |  | 2012 | 136 |  | wood
 |  |  |  |  |  | 2012 | 136 |  | wood
 |  |  |  |  |  | 2012 | 136 |  | wood
 |  |  |  | T1 |  | 2012 | 136 |  | wood
 |  |  |  |  |  | 2012 | 136 |  | company
 |  |  |  |  |  | 2012 | 136 |  | company
 |  |  |  |  |  | 2012 | 136 |  | company
 |  |  |  |  |  | 2012 | 136. |  | company
 |  |  |  | T1 |  | 2012 | 136 |  | company
 |  |  |  |  |  | 2012 | 143
 |  |  |  |  |  | 2012 | 143
 |  |  |  |  |  | 2012 | 143
 |  |  |  | T1 |  | 2012 | 143
 |  |  |  |  |  | 2012 | 145
 |  |  |  |  |  | 2012 | 145
 |  |  |  | T1 |  | 2012 | 145
 |  |  |  |  |  | 2012 | 182 |  | office
 |  |  |  |  |  | 2012 | 182 |  | office
 |  |  |  | T1 |  | 2012 | 182 |  | office
 |  |  |  |  |  | 2012 | 182 |  | 1-1
 |  |  |  | T1 |  | 2012 | 182 |  | 1-1
 |  |  |  |  |  | 2012 | 182 |  | 1-2
 |  |  |  | T1 |  | 2012 | 182 |  | 1-2
 |  |  |  |  |  | 2012 | 182 |  | 1-3
 |  |  |  | T1 |  | 2012 | 182 |  | 1-3
 |  |  |  |  |  | 2012 | 182 |  | 2-2
 |  |  |  | T1 |  | 2012 | 182 |  | 2-2
 |  |  |  |  |  | 2012 | 182 |  | company
 |  |  |  |  |  | 2012 | 182 |  | company
 |  |  |  |  |  | 2012 | 182 |  | company
 |  |  |  | T1 |  | 2012 | 182 |  | company
 |  |  |  |  |  | 2012 | 177 |  | office
 |  |  |  |  |  | 2012 | 177 |  | office
 |  |  |  | T1 |  | 2012 | 177 |  | office
 |  |  |  |  |  | 2012 | 177 |  | dock
 |  |  |  |  |  | 2012 | 177 |  | dock
 |  |  |  |  |  | 2012 | 177 |  | dock
 |  |  |  |  |  | 2012 | 177 |  | dock
 |  |  |  |  |  | 2012 | 177 |  | dock
 |  |  |  | T1 |  | 2012 | 177 |  | dock
 |  |  |  |  |  | 2012 | 177 |  | shop
 |  |  |  | T1 |  | 2012 | 177 |  | shop
 |  |  |  |  |  | 2012 | 177 |  | company
 |  |  |  |  |  | 2012 | 177 |  | company
 |  |  |  |  |  | 2012 | 177 |  | company
 |  |  |  |  |  | 2012 | 177 |  | company
 |  |  |  |  |  | 2012 | 177 |  | company
 |  |  |  | T1 |  | 2012 | 177 |  | company
 |  |  |  |  |  | 2012 | 137
 |  |  |  |  |  | 2012 | 137
 |  |  |  |  |  | 2012 | 137
 |  |  |  | T1 |  | 2012 | 137
 |  |  |  |  |  | 2012 | 152
 |  |  |  |  |  | 2012 | 152
 |  |  |  | T1 |  | 2012 | 152
 |  |  |  |  |  | 2012 | 160
 |  |  |  |  |  | 2012 | 160
 |  |  |  | T1 |  | 2012 | 160
 |  |  |  |  |  | 2012 | 140
 |  |  |  |  |  | 2012 | 140
 |  |  |  |  |  | 2012 | 140
 |  |  |  | T1 |  | 2012 | 140
 |  |  |  |  |  | 2012 | 144
 |  |  |  |  |  | 2012 | 144
 |  |  |  | T1 |  | 2012 | 144
 |  |  |  |  |  | 2012 | 127
 |  |  |  |  |  | 2012 | 127
 |  |  |  | T1 |  | 2012 | 127
 |  |  |  |  |  | 2012 | 139
 |  |  |  |  |  | 2012 | 139
 |  |  |  |  |  | 2012 | 139
 |  |  |  | T1 |  | 2012 | 139
 |  |  |  |  |  | 2012 | 183 |  | city hall
 |  |  |  | T1 |  | 2012 | 183 |  | city hall
 |  |  |  |  |  | 2012 | 183 |  | library
 |  |  |  | T1 |  | 2012 | 183 |  | library
 |  |  |  |  |  | 2012 | 183 |  | pw
 |  |  |  |  |  | 2012 | 183 |  | pw
 |  |  |  |  |  | 2012 | 183 |  | pw
 |  |  |  | T1 |  | 2012 | 183 |  | pw
 |  |  |  |  |  | 2012 | 183 |  | cc
 |  |  |  |  |  | 2012 | 183 |  | cc
 |  |  |  |  |  | 2012 | 183 |  | cc
 |  |  |  |  |  | 2012 | 183 |  | cc
 |  |  |  | T1 |  | 2012 | 183 |  | cc
 |  |  |  |  |  | 2012 | 183 |  | company
 |  |  |  |  |  | 2012 | 183 |  | company
 |  |  |  |  |  | 2012 | 183 |  | company
 |  |  |  |  |  | 2012 | 183 |  | company
 |  |  |  | T1 |  | 2012 | 183 |  | company
 |  |  |  |  |  | 2012 | 129 |  | 1
 |  |  |  |  |  | 2012 | 129 |  | 3
 |  |  |  |  |  | 2012 | 129 |  | 1
 |  |  |  | T1 |  | 2012 | 129 |  | company
 |  |  |  |  |  | 2012 | 168 |  | main
 |  |  |  |  |  | 2012 | 168 |  | shop
 |  |  |  | T1 |  | 2012 | 168 |  | company
 |  |  |  |  |  | 2012 | 138
 |  |  |  |  |  | 2012 | 138
 |  |  |  | T1 |  | 2012 | 138 |  | company
 |  |  |  |  |  | 2012 | 165 |  | 1
 |  |  |  |  |  | 2012 | 165 |  | 1
 |  |  |  |  |  | 2012 | 165 |  | 3
 |  |  |  | T1 |  | 2012 | 165 |  | company
 |  |  |  |  |  | 2012 | 113
 |  |  |  |  |  | 2012 | 113
 |  |  |  |  |  | 2012 | 113
 |  |  |  | T1 |  | 2012 | 113 |  | company
 |  |  |  |  |  | 2012 | 130 |  | main
 |  |  |  |  |  | 2012 | 130 |  | main
 |  |  |  | T1 |  | 2012 | 130 |  | main
 |  |  |  |  |  | 2012 | 130 |  | truck
 |  |  |  |  |  | 2012 | 130 |  | company
 |  |  |  |  |  | 2012 | 130 |  | company
 |  |  |  |  |  | 2012 | 130 |  | company
 |  |  |  | T1 |  | 2012 | 130 |  | company