Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Change divisor if column is 0

D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so that
it only divides by the number of columns with a value? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default Change divisor if column is 0

Try using =Average(A1:C1)



"Carol Mac" wrote:

D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so that
it only divides by the number of columns with a value? Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Change divisor if column is 0

Maybe

=SUM(A1:C1)/COUNTIF(A1:C1,"0")



--
Regards,

Peo Sjoblom



"Carol Mac" wrote in message
...
D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so
that
it only divides by the number of columns with a value? Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,311
Default Change divisor if column is 0

Maybe one way would be:

=(A1+B1+C1)/COUNTIF(A1:C1,"0")

HTH,
Paul

"Carol Mac" wrote in message
...
D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so
that
it only divides by the number of columns with a value? Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Change divisor if column is 0

Thanks Barb - doesn't do it. If A1 is 0, it still averages based on 3
instead of 2. Any other thoughts?

"Barb Reinhardt" wrote:

Try using =Average(A1:C1)



"Carol Mac" wrote:

D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so that
it only divides by the number of columns with a value? Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default Change divisor if column is 0

OK, I missed that. How about this:

=AVERAGE(IF(A1:C1<0,A1:C1))

commit with CTRL SHIRT ENTER.

"Carol Mac" wrote:

Thanks Barb - doesn't do it. If A1 is 0, it still averages based on 3
instead of 2. Any other thoughts?

"Barb Reinhardt" wrote:

Try using =Average(A1:C1)



"Carol Mac" wrote:

D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so that
it only divides by the number of columns with a value? Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Change divisor if column is 0

Thanks Peo & Paul - this gives me a #DIV/0! error. I also tried COUNT,
COUNTBLANK and COUNTA. None worked.

"Peo Sjoblom" wrote:

Maybe

=SUM(A1:C1)/COUNTIF(A1:C1,"0")



--
Regards,

Peo Sjoblom



"Carol Mac" wrote in message
...
D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so
that
it only divides by the number of columns with a value? Thanks.




  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 698
Default Change divisor if column is 0

Try this:

=IF(COUNTIF(A1:C1,"0"),SUM(A1:C1)/COUNTIF(A1:C1,"0"),0)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Carol Mac" wrote:

D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so that
it only divides by the number of columns with a value? Thanks.

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Change divisor if column is 0

If you get a DIV error then all three cells must be empty or negative
meaning the only way is that if the countif part returns zero and that means
no values in A1:C1 are greater than zero, if that's the case

=IF(COUNTIF(A1:C1,"0")=0,0,SUM(A1:C1)/COUNTIF(A1:C1,"0"))

will return zero if that's the case, if you have negative values and you
just want to
check for empty cells

=IF(COUNT(A1:C1)=0,0,SUM(A1:C1)/COUNTIF(A1:C1,"<"))

Another way

=IF(COUNT(A1:C1)=0,0,AVERAGE(IF(A1:C1<"",A1:C1)))

entered with ctrl + shift & enter

--
Regards,

Peo Sjoblom





"Carol Mac" wrote in message
...
Thanks Peo & Paul - this gives me a #DIV/0! error. I also tried COUNT,
COUNTBLANK and COUNTA. None worked.

"Peo Sjoblom" wrote:

Maybe

=SUM(A1:C1)/COUNTIF(A1:C1,"0")



--
Regards,

Peo Sjoblom



"Carol Mac" wrote in message
...
D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so
that
it only divides by the number of columns with a value? Thanks.






  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,311
Default Change divisor if column is 0

Two ways:

=IF(SUM(A1:C1)0,SUM(A1:C1)/COUNTIF(A1:C1,"0"),0)

=IF(SUM(A1:C1)=0,"",SUM(A1:C1)/SUMPRODUCT(--(A1:C1<""),--(A1:C1<0)))


Good luck,
Paul

"Carol Mac" wrote in message
...
Thanks Peo & Paul - this gives me a #DIV/0! error. I also tried COUNT,
COUNTBLANK and COUNTA. None worked.

"Peo Sjoblom" wrote:

Maybe

=SUM(A1:C1)/COUNTIF(A1:C1,"0")



--
Regards,

Peo Sjoblom



"Carol Mac" wrote in message
...
D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so
that
it only divides by the number of columns with a value? Thanks.








  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Change divisor if column is 0

Thanks to all that replied - none of them worked but I appreciate everyone's
input.

"Ron Coderre" wrote:

Try this:

=IF(COUNTIF(A1:C1,"0"),SUM(A1:C1)/COUNTIF(A1:C1,"0"),0)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Carol Mac" wrote:

D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so that
it only divides by the number of columns with a value? Thanks.

  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Change divisor if column is 0

This worked - Iwhen I first tried it I entered the wrong cells - DUH. Thanks
again to all.

"Peo Sjoblom" wrote:

Maybe

=SUM(A1:C1)/COUNTIF(A1:C1,"0")



--
Regards,

Peo Sjoblom



"Carol Mac" wrote in message
...
D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so
that
it only divides by the number of columns with a value? Thanks.




  #13   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Change divisor if column is 0

All should work, this is not rocket science, in fact this problem should be
easy to solve. Can you be more specific what does not work and when it does
not work what the contents of those cells are? It might be that what you
think are numbers are text. What do you get if you use

=COUNTA(A1:C1)-COUNT(A1:C1)=0

if you get FALSE you have text in the cells


--
Regards,

Peo Sjoblom

"Carol Mac" wrote in message
...
Thanks to all that replied - none of them worked but I appreciate
everyone's
input.

"Ron Coderre" wrote:

Try this:

=IF(COUNTIF(A1:C1,"0"),SUM(A1:C1)/COUNTIF(A1:C1,"0"),0)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Carol Mac" wrote:

D1=(A1+B1+C1)/3
If A1, B1 or C1 have a 0 value, can the divisor change automatically so
that
it only divides by the number of columns with a value? Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change column references, while filling down another column bclancy12 Excel Discussion (Misc queries) 1 June 7th 06 04:13 PM
How can I change column numbers back to column letters? Space Elf Excel Worksheet Functions 3 March 2nd 06 09:35 PM
Right column doesn't change when sorting left column. nohope Excel Discussion (Misc queries) 2 July 19th 05 03:27 PM
How do I change column into lines on a Line-Column chart? Ken Charts and Charting in Excel 1 March 17th 05 02:29 PM
Change the width of a single column in a column chart Dave Charts and Charting in Excel 2 December 13th 04 07:25 PM


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"