failing with MAX and IFs

mishelli

New Member
Joined
Aug 15, 2015
Messages
5
Hi guys,
I hope you might be able to help me figure out why my formula isn't working. Here is a screen cap of what is happening.

http://i.imgur.com/LMyK9vh.png

The formula in X6613 is =MAX(IF((FirstHb<>"u")*(UnitsTransfused=0),W$2:W$6594,0))

But you can see in the filtered results that clearly there are only 5 results for people not transfused and the max value should actually be 12.7. What am I missing here?

thanks in advance!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi and welcome to the MrExcel Message Board,

I don't know. It looks OK to me.


Excel 2013
UVWX
1Units TranEdinburgh1st tri hgb
20u
30u
40u
50u
6012.7
7012.5
8011.1
909.9
1006.112.7
11
12
Sheet1
Cell Formulas
RangeFormula
X10=MAX(IF((FirstHb<>"u")*(UnitsTransfused=0),W$2:W$6594,0))
Named Ranges
NameRefers ToCells
FirstHb=Sheet1!$W$2:$W$20
UnitsTransfused=Sheet1!$U$2:$U$20


Have you defined your named ranges correctly? I defined mine to be the shaded areas in the extract above.
 
Upvote 0
Hi, thanks for the quick reply.

I checked to ensure my named ranges are correct. In fact, I typed in the addresses (like, U2:U6494) and it replaced it with the ranges so I'm going to say that those are fine. And actually when I look, the cell that results the 14.8 is a cell that should not even be included since for that particular individual, UnitsTransfused is blank.

However I noticed that if I don't Control+Shift+Enter the formula (which I notice you did not), I get a #VALUE error. Does that offer any clues or does that just tell us what we already know - I am using arrays?
 
Upvote 0
UnitsTransfused is blank.

Does the cell contain a blank or is it empty? Empty counts as zero but blank does not.

And, yes, I should be using arrays but it did not make it to the display - sorry about that.
 
Upvote 0
The formula posted by RickXL returns the correct result only because it is the first value. Change U6 to >0 and the result does not change. Enter the formula as an array and it works for me.
 
Upvote 0
Try this, as an array, change the range to suit
=MAX(IF((C2:C10<>"u")*(A2:A10=0)*(A2:A10<>""),C$2:C$10,0))
 
Upvote 0
Does the cell contain a blank or is it empty? Empty counts as zero but blank does not.

And, yes, I should be using arrays but it did not make it to the display - sorry about that.

I'm not very savvy about blank vs empty vs null but to my knowledge the cells are blank. In any event, since I'm trying to evaluate the Max value, isn't that moot?
 
Upvote 0
If I put 888 in cell W11 the maximum value goes to 888.
If I now put a blank or space character into cell U11 the maximum value reverts to 12.7.
 
Upvote 0
Try this, as an array, change the range to suit
=MAX(IF((C2:C10<>"u")*(A2:A10=0)*(A2:A10<>""),C$2:C$10,0))

Ok that fixed it! Thanks so much for the help. And for edu-ma-cation purposes, does anyone know why the blanks are causing problems in that formula?

Also as a followup question, I seem to be also failing at counting. http://i.imgur.com/ZsHi843.png
I'm trying to count the number of registered people who were transfused.

In cell W6616 I have =COUNTIFS(UnitsTransfused,">0",UnitsTransfused,"<>0",Registered,"=y")

I subsequently filtered column U (Units Transfused) to show results greater than 0 and Column M (Registered) to show results equal to "Y." Then in U6616 the formula I employed was: =SUBTOTAL(2,U2:U6594)

Now my question is, why are there 95 results in one and 94 results in the other. I was OCD enough to count them individually and indeed, there are 95. So where is my 'lost' cell and how do I find it?
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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