Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
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  
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  
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  
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  
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  
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  
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  
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  
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  
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




  #11   Report Post  
Posted to microsoft.public.excel.misc
cervenyc
 
Posts: n/a
Default trying to make a formula for percent if greater than a value

Thanks guys for all your help. For future seakers of the solution, here's
what I've done...

=(COUNTIF(F12,"0")+COUNTIF(I12,"0")+COUNTIF(L12, "0")+COUNTIF(O12,"0")+COUNTIF(R12,"0")+COUNTIF( U12,"0"))/COUNT(F12,I12,L12,O12,R12,U12)


=SUM(IF(F120,F12,FALSE),IF(I120,I12,FALSE),IF(L1 20,L12,FALSE),IF(O120,O12,FALSE),IF(R120,R12,FA LSE),IF(U120,U12,FALSE))/(COUNTIF(F12,"0")+COUNTIF(I12,"0")+COUNTIF(L12," 0")+COUNTIF(O12,"0")+COUNTIF(R12,"0")+COUNTIF(U 12,"0"))


=SUM(IF(F120,G12,FALSE),IF(I120,J12,FALSE),IF(L1 20,M12,FALSE),IF(O120,P12,FALSE),IF(R120,S12,FA LSE),IF(U120,V12,FALSE))/(COUNTIF(F12,"0")+COUNTIF(I12,"0")+COUNTIF(L12," 0")+COUNTIF(O12,"0")+COUNTIF(R12,"0")+COUNTIF(U 12,"0"))

This gives me my percent survival, my average rank of those that survived,
and the average of the number of whatevers that correspond to surviving
units. Hope it helps.

Thanks again for all the advice!



"cervenyc" wrote:

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
Formula for selecting the greater of two values? Boriana Excel Worksheet Functions 6 April 5th 23 01:05 PM
Is it possible? DakotaNJ Excel Worksheet Functions 25 September 18th 06 09:30 PM
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 01:26 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"