Multiplying Empty Cells

W

Workbook

In cell N15, I am using this formula M15*24. However sometimes M15 is blank
and when it is I get a message in cell N15 that says #VALUE!. Which throws
off other formulas.

I need help adding an IF statement to this formula M15*24 so that cell N15
in which the formula is located will become blank or “0†when M15 does not
have a value/is blank. Biff and JE McGimpsey recommended I use
=IF(COUNT(K15:L15)<>2,"" for a similar problem I had while subtracting dates
and it has worked awesome. I tried adding it to the current formula and I
came up with =IF(COUNT(M4)<>2,"",(M4*24)-1) but I didn’t get the same result
which is the blank cell I was looking for. Any thoughts?
 
T

T. Valko

=IF(COUNT(M4)<>2,"",(M4*24)-1)

Since you're testing a single cell try it like this:

=IF(COUNT(M4),(M4*24)-1,"")

COUNT returns the count of numbers referenced in its arguments. If you're
testing a single cell the result of COUNT can only be 1 or 0. Excel
evaluates *any* number other than 0 as being TRUE. So, if COUNT =1 VLOOKUP
returns the value_if_true argument which is M4*24)-1. If COUNT =0 VLOOKUP
returns the value_if_false argument which is "", an empty TEXT string that
makes the cell appear blank.

You could also use something like this:

=IF(M4<>"",(M4*24)-1,"")

Which means: if M4 is not equal to blank

However, if M4 contained a TEXT entry (either by mistake or intentionally)
then you'll get a #VALUE! error as the formula result. So, using the
=IF(COUNT(M4)... version is more robust.
 
J

JE McGimpsey

COUNT(M4) can only be 1 (if it contains a numeric value) or 0 (if it
doesn't) so IF(COUNT(M4)=2, will always execute the FALSE branch.

the problem is that your "blank" cell isn't blank - you (or someone)
probably "cleared" it using the space bar, which inserts a space
character (i.e., a text string). That's what's choking your formula.

You could use

=IF(COUNT(M25),M15*24,0)
 
W

Workbook

I see you're point. Thank you for taking the time to explain that to me. I
have also appreciated your ongoing help. Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top