Mode if function

brooksc29

Active Member
Joined
Jul 25, 2010
Messages
333
How can I find the mode using an IF criteria.

I need to say, find the MODE in k2:k77 if b2:b77 = Hernandez and c2:c77 = W

thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
You can use an "array formula" like this

=MODE(IF(B2:B77="Hernandez",IF(C2:C77="W",K2:K77)))

confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
I'm getting #N/A with that array... when I hit the Fx to look into the function, there's nothing in the second box for Number 2, not sure if that matters.

Instead of putting Hernandez the array, I entered the cell where Hernandez is B89 so the array looks like this...
=MODE(IF(B$2:B$77=$B89,IF(C$2:C$77="W",K$2:K$77)))

still getting N/A however
 
Upvote 0
I'm getting #N/A with that array... when I hit the Fx to look into the function, there's nothing in the second box for Number 2, not sure if that matters.

Instead of putting Hernandez the array, I entered the cell where Hernandez is B89 so the array looks like this...
=MODE(IF(B$2:B$77=$B89,IF(C$2:C$77="W",K$2:K$77)))

still getting N/A however
Are you sure there is a mode? If there is no mode then the MODE function will return #N/A.
 
Upvote 0
If you modify the formula like this

=MODE(IF(B$2:B$77=$B89,IF(C$2:C$77="W",K$2:K$77*{1,1})))

then that will give you the modal value....even if there are no repeats
 
Upvote 0
there is a mode for most, although its a small sample size, sometimes only 3 instances and 2 of them would be the same.
 
Upvote 0
=MODE(IF(B$2:B$77=$B89,IF(C$2:C$77="W",K$2:K$77*{1,1})))

this is giving me #VALUE.

is that what you meant by modal value?
 
Upvote 0
Are you confirming the formula with CTRL+SHIFT+ENTER?

select cell with formula, press F2 key then hold down CTRL and SHIFT keys and press ENTER so that curly braces like { and } appear around the formula in the formula bar.

If you have done that and you still get #VALUE! error that may be because you have text in K2:K77, is that possible?
 
Upvote 0
yes, it is text in K2:K77, sorry, I didn't know that made things difficult.

i have been entering it as an array with CTR/SHFT/ENTER
 
Upvote 0
MODE itself only works with numbers - if you want the most common text value given those conditions try

=INDEX(K$2:K$77,MODE(IF(B$2:B$77=$B89,IF(C$2:C$77="W",IF(K$2:K$77<>"",MATCH(K$2:K$77,K$2:K$77,0))))))

still with CTRL+SHIFT+ENTER
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top