I need to first match the ID, then the VENDOR, and if the TYPE contains the words "next", then give me the largest (MAX) of the values matched. In some instances TYPE matches twice, in others one, and others none.
Ideally this would be in formula format, I can't add macros/VBA to the file.
I have tried two formulas, both with no good result, FYI, the data is formatted as a table and named DataTable.
I tried: '{=LARGE(IF(DataTable[TYPE]="*next*",INDEX(DataTable[VALUE],MATCH(1,(DataTable[ID]=G4)*(DataTable[VENDOR]=G5),0)),"not found"),1}
and I also tried: '{=LARGE(IF((DataTable[ID]=G11)*(DataTable[VENDOR]=G12)*(DataTable[TYPE]="*next*"),DataTable[VALUE],""),ROW($A$2))}
Neither of these work for me.
Any help is greatly appreciated. Image attached with the scenario.
Ideally this would be in formula format, I can't add macros/VBA to the file.
I have tried two formulas, both with no good result, FYI, the data is formatted as a table and named DataTable.
I tried: '{=LARGE(IF(DataTable[TYPE]="*next*",INDEX(DataTable[VALUE],MATCH(1,(DataTable[ID]=G4)*(DataTable[VENDOR]=G5),0)),"not found"),1}
and I also tried: '{=LARGE(IF((DataTable[ID]=G11)*(DataTable[VENDOR]=G12)*(DataTable[TYPE]="*next*"),DataTable[VALUE],""),ROW($A$2))}
Neither of these work for me.
ID | VENDOR | TYPE | VALUE | EXAMPLE 1: LOOKUP RESULT | |||
2 | ACME | FTL other | 1.18 | ID | 2 | ||
2 | ACME | Six next-day | 1.25 | VENDOR | BELFRY | ||
2 | ACME | two next day | 1.25 | TYPE | *next* | ||
2 | ACME | mixed | 1.25 | VALUE | 1.12 | <---correct answer from formula should be | |
2 | BELFRY | FTL other | 1.05 | ||||
2 | BELFRY | Six next-day | 1.08 | ||||
2 | BELFRY | two next day | 1.12 | EXAMPLE 2: LOOKUP RESULT | |||
2 | CROSS | FTL other | 1.01 | ID | 2 | ||
2 | CROSS | Six next-day | 1.09 | VENDOR | ACME | ||
2 | CROSS | two next day | 1.15 | TYPE | *next* | ||
2 | DINGO | FTL other | 1.01 | VALUE | 1.25 | <---correct answer from formula should be | |
2 | DINGO | FTL mixed | 1.09 | even though both "next" matches are the same "1.25" | |||
2 | DINGO | two next day | 1.15 | ||||
EXAMPLE 3: LOOKUP RESULT | |||||||
ID | 2 | ||||||
VENDOR | DINGO | ||||||
TYPE | *next* | ||||||
VALUE | 1.15 | <---correct answer from formula should be | |||||
even though there is only one "next" day match |
Any help is greatly appreciated. Image attached with the scenario.