How to omit certain cells in formula

K

Klemen25

Hello

If I have monthly data in a table, but data form April on is not
available yet, but I would like to be inputted automatically from some
other table when it becomes available there. So I put in the cell a
formula =DATA!I49.

And as the source is empty so far- I get the result of the formula
'0'.

But at the end of this line (that now includes data till March and for
the next 9 months there are 0) I have formula for average- which by
now also takes in to account the 0 in the line- which I do not want.

What would be the best way to tell the excel that: calculate average
in the line for those cells that are not equal 0?

Thank you very much- it is not life or death situation of course, but
I would like to crack this...
Best regards
 
K

Klemen25

Thank you very much...
the formula =SUM(A1:M1)/COUNTIF(A1:M1,">0") works.
But I forgot to say (stupid me!- but I also didn't see it till now)
that I also have one negative number..
I would like to change this to: calculate average in the line for
those cells that are higher or lower of 0?
 
G

Gord Dibben

Alternate route.

Get rid of the zeros.

=IF(Data!I49="","",Data!I49)


Gord Dibben MS Excel MVP
 
D

Don Guillett

An array formula that must be entered using ctrl+shift+enter
=AVERAGE(IF(a1:m1>0,a1:m1))
 
R

Roger Govier

It often helps to tackle the problem from the other direction.
Much simpler Gord.
 
G

Gord Dibben

Thanks

But........the negatives had to be taken care of also so OP needed more than
than one solution.

We got it covered<g>
 

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

Similar Threads

Ignoring Blank cells 9
SUM / COUNT formula 3
Excel 2007 average formula 3
Excel Need Countifs Formula Help 0
Array formula difficulty 10
Omit empty cells? 0
same formula and cells for different worksheets 1
Excel VBA 1

Top