Excel formula needs to ignore empty cells

PDIS
PDIS used Ask the Experts™
on
I need assistance with the following excel formula in cell f3

If (and b3, c3) b3-c3)
The intent is - Do only if there is a value in both b3 and c3

This formula would be copied down to the full column and then the values in the column would be averaged. I do not want to average values in that came from rows that did not have data in both columns B and C.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
Try:

=IF(AND(B3<>"",C3<>""),B3-C3,"")

Copy down as needed.
if((B3<>"")and(C3<>"");your-formula-here;"")

So, in first section query if B3 and C3 fields are filled up, if YES, then execute formula, if NOT, then put empty space in cell ""
Most Valuable Expert 2011
Top Expert 2011

Commented:
alternative to check for two numbers
=IF(COUNT(B3:C3)=2,B3-C3,"")

Author

Commented:
Thank you, both worked!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial