Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old January 10th 06, 10:25 PM posted to microsoft.public.excel.misc
cervenyc
 
Posts: n/a
Default trying to make a formula for percent if greater than a value

I am trying to create a formula that will calculate percent survival.
Basically I have data in cells and I want to make a fomula that tests if
there is a value greater than 0. I want my answer to be not the values in the
box, but the number of cells with data greater than zero divided by the total
number of cells.

Then, I'd like to write another formula to average the values in those
cells, but only if those cells have a value greater than zero. Can anyone
help?

  #2   Report Post  
Old January 10th 06, 10:57 PM posted to microsoft.public.excel.misc
SteveG
 
Posts: n/a
Default trying to make a formula for percent if greater than a value


I think I got this straight. In one instance, you want to count the
number of cells in a range that are greater than zero and divide it by
the total number of cells in the range.

=COUNTIF(A1:A8,"0")/SUM(COUNTBLANK(A1:A8)+COUNTIF(A1:A8,"0"))

A1:A8 being the range.

Then you also want to average the values from the range A1:A8 if they
are greater than zero?

=AVERAGE(IF(A1:A80,A1:A8,FALSE))

This is an array so you need to commit with Ctrl-Shift-Enter which
results in the formula being enclosed in curly brackets like.

{=AVERAGE(IF(A1:A80,A1:A8,FALSE))}

HTH


Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=499913

  #3   Report Post  
Old January 10th 06, 11:02 PM posted to microsoft.public.excel.misc
bigwheel
 
Posts: n/a
Default trying to make a formula for percent if greater than a value

You need to use COUNT for the number of cells and COUNTIF for those
containing values greater than zero. i.e. =COUNT(A1:A10) will result in 10.
If, say, three of those cells contain zero, =COUNTIF(A1:A10,"0") will result
in 7

If I understand the question correctly, your desired calculation would
therefore be 7/10 or =COUNTIF(A1:A10,"0")/COUNT(A1:A10)

"cervenyc" wrote:

I am trying to create a formula that will calculate percent survival.
Basically I have data in cells and I want to make a fomula that tests if
there is a value greater than 0. I want my answer to be not the values in the
box, but the number of cells with data greater than zero divided by the total
number of cells.

Then, I'd like to write another formula to average the values in those
cells, but only if those cells have a value greater than zero. Can anyone
help?

  #4   Report Post  
Old January 12th 06, 03:21 PM posted to microsoft.public.excel.misc
cervenyc
 
Posts: n/a
Default trying to make a formula for percent if greater than a value

The countif function doesn't seem to work when I'm not applying it to a
range. Well, I am applying it to a range, but it is not a continuous range.
i.e. not A1:A8, but rather A1,A3,A6,A8. How do I make the formula work
without a continuous range? Thanks.


"SteveG" wrote:


I think I got this straight. In one instance, you want to count the
number of cells in a range that are greater than zero and divide it by
the total number of cells in the range.

=COUNTIF(A1:A8,"0")/SUM(COUNTBLANK(A1:A8)+COUNTIF(A1:A8,"0"))

A1:A8 being the range.

Then you also want to average the values from the range A1:A8 if they
are greater than zero?

=AVERAGE(IF(A1:A80,A1:A8,FALSE))

This is an array so you need to commit with Ctrl-Shift-Enter which
results in the formula being enclosed in curly brackets like.

{=AVERAGE(IF(A1:A80,A1:A8,FALSE))}

HTH


Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=499913


  #5   Report Post  
Old January 12th 06, 03:46 PM posted to microsoft.public.excel.misc
SteveG
 
Posts: n/a
Default trying to make a formula for percent if greater than a value


Try this. If you always no that you will be evaluating 4 cells then for
the percent of cells what are greater than zero.

=COUNT(A1,A3,A6,A8)/4


You can still use the AVERAGE and IF functions as shown in my first
post to get the average of the values provided that cells A2, A4, A5 &
A7 will not contain numeric values.


HTH

Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=499913



  #6   Report Post  
Old January 12th 06, 03:46 PM posted to microsoft.public.excel.misc
Peo Sjoblom
 
Posts: n/a
Default trying to make a formula for percent if greater than a value

Best would be to link the cells to a continuous range otherwise if you only
have 4 cells you can just add them like

=COUNTIF(A1,"0")+COUNTIF(A3,"0")+etc

if you have many cells you can select them using ctrl and mouse click and
then give them a name like MyRange (insertnamedefine) and use


=SUMPRODUCT(--(LARGE((MyRange),ROW(INDIRECT("1:"&COUNT(MyRange)) ))0))


--

Regards,

Peo Sjoblom



"cervenyc" wrote in message
...
The countif function doesn't seem to work when I'm not applying it to a
range. Well, I am applying it to a range, but it is not a continuous

range.
i.e. not A1:A8, but rather A1,A3,A6,A8. How do I make the formula work
without a continuous range? Thanks.


"SteveG" wrote:


I think I got this straight. In one instance, you want to count the
number of cells in a range that are greater than zero and divide it by
the total number of cells in the range.

=COUNTIF(A1:A8,"0")/SUM(COUNTBLANK(A1:A8)+COUNTIF(A1:A8,"0"))

A1:A8 being the range.

Then you also want to average the values from the range A1:A8 if they
are greater than zero?

=AVERAGE(IF(A1:A80,A1:A8,FALSE))

This is an array so you need to commit with Ctrl-Shift-Enter which
results in the formula being enclosed in curly brackets like.

{=AVERAGE(IF(A1:A80,A1:A8,FALSE))}

HTH


Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile:

http://www.excelforum.com/member.php...fo&userid=7571
View this thread:

http://www.excelforum.com/showthread...hreadid=499913




  #7   Report Post  
Old January 12th 06, 04:16 PM posted to microsoft.public.excel.misc
cervenyc
 
Posts: n/a
Default trying to make a formula for percent if greater than a value

Okay, Thank you very much for your help.

I have used a combination of the above formulas to make this basic example:
=(COUNTIF(A12,"0")+COUNTIF(b12,"0")+COUNTIF(C12, "0")+COUNTIF(D12,"0")+etc)/COUNT(A12,B12,C12,D12,ETC)

This seems to have solved my basic problem. The challenge will be when I
have a value such as "." instead of 0 and I want it to drop that value. So
instead of evaluating 6 cells, I might only want it to evaluate 5. I'll mess
around with this and see what I come up with... Thanks again!


"Peo Sjoblom" wrote:

Best would be to link the cells to a continuous range otherwise if you only
have 4 cells you can just add them like

=COUNTIF(A1,"0")+COUNTIF(A3,"0")+etc

if you have many cells you can select them using ctrl and mouse click and
then give them a name like MyRange (insertnamedefine) and use


=SUMPRODUCT(--(LARGE((MyRange),ROW(INDIRECT("1:"&COUNT(MyRange)) ))0))


--

Regards,

Peo Sjoblom



"cervenyc" wrote in message
...
The countif function doesn't seem to work when I'm not applying it to a
range. Well, I am applying it to a range, but it is not a continuous

range.
i.e. not A1:A8, but rather A1,A3,A6,A8. How do I make the formula work
without a continuous range? Thanks.


"SteveG" wrote:


I think I got this straight. In one instance, you want to count the
number of cells in a range that are greater than zero and divide it by
the total number of cells in the range.

=COUNTIF(A1:A8,"0")/SUM(COUNTBLANK(A1:A8)+COUNTIF(A1:A8,"0"))

A1:A8 being the range.

Then you also want to average the values from the range A1:A8 if they
are greater than zero?

=AVERAGE(IF(A1:A80,A1:A8,FALSE))

This is an array so you need to commit with Ctrl-Shift-Enter which
results in the formula being enclosed in curly brackets like.

{=AVERAGE(IF(A1:A80,A1:A8,FALSE))}

HTH


Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile:

http://www.excelforum.com/member.php...fo&userid=7571
View this thread:

http://www.excelforum.com/showthread...hreadid=499913





  #8   Report Post  
Old January 12th 06, 04:46 PM posted to microsoft.public.excel.misc
cervenyc
 
Posts: n/a
Default trying to make a formula for percent if greater than a value

I guess I'm not clear what you mean about the array... please see below:

"SteveG" wrote:


I think I got this straight. In one instance, you want to count the
number of cells in a range that are greater than zero and divide it by
the total number of cells in the range.

=COUNTIF(A1:A8,"0")/SUM(COUNTBLANK(A1:A8)+COUNTIF(A1:A8,"0"))

A1:A8 being the range.

Then you also want to average the values from the range A1:A8 if they
are greater than zero?

=AVERAGE(IF(A1:A80,A1:A8,FALSE))

This is an array so you need to commit with Ctrl-Shift-Enter which
results in the formula being enclosed in curly brackets like.

{=AVERAGE(IF(A1:A80,A1:A8,FALSE))}


As I mentioned in my other post, I don't have A1:A8, rather I have them
across rows and not in ever cell. Ex/ F1, I1, L1, O1, R1, U1. I've come up
with (based on your suggestions) a way to find a count of the number of cells
in which the value is greater than zero, and divide this over the total
number of cells surveyed. But now I want to take the average of the values in
those cells.

Then to make it more complicated (as long as you are helping) if the values
in F1, I1, L1,O1, R1, U1 for example is greater than 0, then I want the
average of values in adjacent cells. So for example lets say I,L,O had values
greater than 0, then I want the average of the contents in J12,M12,P12.
Make sense? Thanks.




HTH


Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=499913


  #9   Report Post  
Old January 12th 06, 04:54 PM posted to microsoft.public.excel.misc
SteveG
 
Posts: n/a
Default trying to make a formula for percent if greater than a value


Enter the formula as you normally would.


=AVERAGE(IF(A1:A80,A1:A8,FALSE))

When you are done typing in the formula, rather than hitting the Enter
key, hit the Ctrl, Shift & Enter keys simultaneously. That will create
the {} around the formula automatically. Don't type them in yourself.

HTH

Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=499913

  #10   Report Post  
Old January 12th 06, 05:31 PM posted to microsoft.public.excel.misc
cervenyc
 
Posts: n/a
Default trying to make a formula for percent if greater than a value

I got it to work, but the formula averages a zero when the statement is
false. How do I make a false statement render a blank cell, or to drop the
value? If the value is 0, then I want it excluded, I only want to average
values greater than 0. Thanks.



"SteveG" wrote:


Enter the formula as you normally would.


=AVERAGE(IF(A1:A80,A1:A8,FALSE))

When you are done typing in the formula, rather than hitting the Enter
key, hit the Ctrl, Shift & Enter keys simultaneously. That will create
the {} around the formula automatically. Don't type them in yourself.

HTH

Steve


--
SteveG
------------------------------------------------------------------------
SteveG's Profile: http://www.excelforum.com/member.php...fo&userid=7571
View this thread: http://www.excelforum.com/showthread...hreadid=499913




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
Is it possible? DakotaNJ Excel Worksheet Functions 25 September 18th 06 09:30 PM
Formula for selecting the greater of two values? Boriana Excel Worksheet Functions 5 December 30th 05 06:26 AM
How do I make this formula? adam2dot0 Excel Discussion (Misc queries) 1 December 10th 05 10:22 AM
how do I make a formula NOT change when the data range is moved? Alida Andrews Excel Discussion (Misc queries) 2 January 6th 05 10:02 PM
How to make a formula display results only if value is greater tha superfooz74 Excel Discussion (Misc queries) 5 December 28th 04 01:40 PM


All times are GMT +1. The time now is 10:36 AM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017