0

I am trying to do something similar to a Averageif with max and min.

Current formula :

=IF(J15<0,MAX('CS+MS'!C:C),MIN('CS+MS'!C:C)) 

When I'm looking in CS+MS Sheet I want to do something like averageif where I can search column B for a word then return column C.

Is this possble?

2 Answers 2

1

If you have OFFICE 365:

=IF(J15<0,MAXIFS('CS+MS'!C:C,'CS+MS'!B:B,"SomeString"),MINIFS('CS+MS'!C:C,'CS+MS'!B:B,"SomeString")) 

IF You have Excel 2010 or later:

=IF(J15<0,AGGREGATE(14,7,'CS+MS'!C:C/('CS+MS'!B:B="SomeString"),1),AGGREGATE(15,7,'CS+MS'!C:C/('CS+MS'!B:B="SomeString"),1)) 

If neither use this array formula:

=IF(J15<0,MAX(IF('CS+MS'!B:B="SomeString",'CS+MS'!C:C)),MIN(IF('CS+MS'!B:B="SomeString",'CS+MS'!C:C))) 

Being an array formula one must use Ctrl-Shift-Enter instead of Enter when exiting edit mode.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks scott, but what if I want to do max? will this also work the same way? or do I reverse the aggregates?
The first criteria in the aggregate tell it what it is. 14 is Large and 15 is Small.
So I would just switch these up in the aggregate function?
That is the only difference between the two, yes
1

For Microsoft 365 users can use below formula at one go.

=LET(x,UNIQUE(A1:A6),y,MINIFS(B1:B6,A1:A6,x),CHOOSE({1,2},x,y)) 

enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.