It looks like the formula you provided is almost correct, but there is a small mistake in the criteria for the AND function. Instead of "C$2:C$1000=2006", it should be "C$2:C$1000=20006" to match the criteria you mentioned in your question.
Here is the corrected formula:
- =QUARTILE(IF(AND(B$2:B$1000=2,C$2:C$1000=20006),D$ 2:D$1000,1),0)
This formula uses the
IF function to check if the values in columns B and C meet the specified criteria. If both conditions are true, it returns the corresponding value in column D. If either condition is false, it returns 1 (or any other value you choose).
The resulting array of values is then passed to the
QUARTILE function, which calculates the median (or any other quartile you specify with the second argument).
Note that this is an
array formula, so you need to press
Ctrl+Shift+Enter instead of just Enter when entering it in the cell. Also, make sure that the range references (
B$2:B$1000,
C$2:C$1000,
D$2:D$1000) match the actual range of your data.