Averaging non consecutive cells excluding zero's

S

stumpy

how can I average non consecutive cells in a row excluding zero's
eg.
A1=2
D1=6
F1=0
J1=4
all cells in the range (A1:K1)have values in them but only the sum of cetain
cell need to be averaged

any help is a appreciated.
 
G

google

=SUM(A1,D1,F1,J1)/(IF(A1<>0,1,0)+IF(J1<>0,1,0)+IF(F1<>0,1,0)+IF
(J1<>0,1,0))

I didn't condtiional the sum as adding zero wouldn't change anything.
 
G

google

Sorry, that should be:

=SUM(A1,D1,F1,J1)/(IF(A1<>0,1,0)+IF(D1<>0,1,0)+IF(F1<>0,1,0)+IF
(J1<>0,1,0))

A little too much copy & paste in the formula bar in the original
reply.
 
B

Bernard Liengme

Not very cleaver but it works:
=(A1+D1+F1+J1)/(4-(A1=0)-(D1=0)-(F1=0)-(J1=0))
best wishes
 

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