Conditional Formula

  • Thread starter Thread starter Brendan J Cuffe
  • Start date Start date
B

Brendan J Cuffe

Can anyone help with the following: -

I have data in cells A2 and A3, in another cell (A10) I need a formula so
that

If there are no values in A2 or A3 the value shown in A10 will be zero and
if there are values in both A2 and A3, A10 will show the average of A2 and
A3 (as in (A2+A3)/2) but if there is a value in A2 and no value in A3 (or
visa versa), A10 shows the value in A2 (or A3) without entering the average
of the two cells.

Regards,
Brendan
 
Try this, assuming you are using number values in your cells, ie: using
a zero (0) instead of an empty cell.

=IF(A2<>0,IF(A3<>0,((A2+A3)/2),A2),IF(A3<>0,A3,0))

No doubt there is a more elegant solution, but I'm pretty crap with
maths and formula logic... well, and Excel formulas in general.

It seemed to work for me though!

Ell
 
simple use the formula:
=AVERAGE(A2:A3)

Your formula (A2+A3)/2 considers empty cells as legal values. Whereas the
AVERAGE function does not consider blank cells.

- Mangesh
 
=IF(AND(A2="",A3=""),"",AVERAGE(A2:A3))

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top