A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

trying to make a formula for percent if greater than a value



 
 
Thread Tools Display Modes
  #1  
Old January 10th, 2006, 09:25 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 10th, 2006, 09:57 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 10th, 2006, 10:02 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 12th, 2006, 02:21 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 12th, 2006, 02:46 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 12th, 2006, 02:46 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 12th, 2006, 03:16 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 12th, 2006, 03:46 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 12th, 2006, 03:54 PM posted to microsoft.public.excel.misc
external usenet poster
 
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  
Old January 12th, 2006, 04:31 PM posted to microsoft.public.excel.misc
external usenet poster
 
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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make this formula? adam2dot0 General Discussion 1 December 10th, 2005 09:22 AM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Worksheet Functions 17 November 25th, 2005 05:18 PM
Can I concatenate text in cells to make a working formula? Matt S. R. General Discussion 11 November 11th, 2005 03:44 PM
Can I make a formula that has the result of "0" remain empty? DangerMouse114 Worksheet Functions 2 May 12th, 2004 06:00 AM
how to make gaps in plotted data when cell has formula D. Eglen Charts and Charting 1 December 4th, 2003 09:19 PM


All times are GMT +1. The time now is 12:46 PM.


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