PC Review


Reply
Thread Tools Rate Thread

counting with multiple conditions

 
 
=?Utf-8?B?ZXppbA==?=
Guest
Posts: n/a
 
      14th Jul 2007
The below formula is working in macro.
myvar= "=countif(a1:a100,10)"
but i need to count the cells containing values between less than 10 and
greater than
five? How to change the above formula to incorporate this?
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      14th Jul 2007
> The below formula is working in macro.
> myvar= "=countif(a1:a100,10)"
> but i need to count the cells containing values between less than 10 and
> greater than
> five? How to change the above formula to incorporate this?


How about this...

myvar= "=countif(a1:a100,""<10"")-countif(a1:a100,""<=5"")"

Note that this excludes 5 and 10 from the range. If you want to include
them, add an equal sign to the '<10' and remove the equal sign from the
'<=5'.

Rick

 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      14th Jul 2007
=COUNTIF(A1:A100,">5")-COUNTIF(A1:A100,">9")


Gord Dibben MS Excel MVP

On Sat, 14 Jul 2007 12:30:00 -0700, ezil <(E-Mail Removed)> wrote:

>The below formula is working in macro.
>myvar= "=countif(a1:a100,10)"
>but i need to count the cells containing values between less than 10 and
>greater than
>five? How to change the above formula to incorporate this?


 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      14th Jul 2007
=COUNTIF(A1:A100,">5")-COUNTIF(A1:A100,">=10")

or
ActiveCell.Formula = "=COUNTIF(A1:A100,"">5"")-COUNTIF(A1:A100,"">=10"")"

--
Regards,
Tom Ogilvy


"ezil" wrote:

> The below formula is working in macro.
> myvar= "=countif(a1:a100,10)"
> but i need to count the cells containing values between less than 10 and
> greater than
> five? How to change the above formula to incorporate this?

 
Reply With Quote
 
=?Utf-8?B?ZXppbA==?=
Guest
Posts: n/a
 
      14th Jul 2007
Thank you MR.Rick and Mr.Gord Dibben
The following formula is working and the other one is giving error message
myvar= "=countif(a1:a100,""<10"")-countif(a1:a100,""<=5"")"


"Rick Rothstein (MVP - VB)" wrote:

> > The below formula is working in macro.
> > myvar= "=countif(a1:a100,10)"
> > but i need to count the cells containing values between less than 10 and
> > greater than
> > five? How to change the above formula to incorporate this?

>
> How about this...
>
> myvar= "=countif(a1:a100,""<10"")-countif(a1:a100,""<=5"")"
>
> Note that this excludes 5 and 10 from the range. If you want to include
> them, add an equal sign to the '<10' and remove the equal sign from the
> '<=5'.
>
> Rick
>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      14th Jul 2007
The formula that Gord posted is meant to be placed directly on the
spreadsheet (no VBA macro is needed for the functionality you asked about).
The reason it is giving you an error message is you are trying to use it in
your macro and the internal quote marks are not set up correctly (inside a
text constant, you need to double up quote marks to produce a single one).

Rick


"ezil" <(E-Mail Removed)> wrote in message
news:C1160E6B-0E11-4638-8D61-(E-Mail Removed)...
> Thank you MR.Rick and Mr.Gord Dibben
> The following formula is working and the other one is giving error message
> myvar= "=countif(a1:a100,""<10"")-countif(a1:a100,""<=5"")"
>
>
> "Rick Rothstein (MVP - VB)" wrote:
>
>> > The below formula is working in macro.
>> > myvar= "=countif(a1:a100,10)"
>> > but i need to count the cells containing values between less than 10
>> > and
>> > greater than
>> > five? How to change the above formula to incorporate this?

>>
>> How about this...
>>
>> myvar= "=countif(a1:a100,""<10"")-countif(a1:a100,""<=5"")"
>>
>> Note that this excludes 5 and 10 from the range. If you want to include
>> them, add an equal sign to the '<10' and remove the equal sign from the
>> '<=5'.
>>
>> Rick
>>
>>


 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      14th Jul 2007
Good point Rick

Forgot I was in programming group.

I rarely get over here. More of a Tools>Options person.


Gord

On Sat, 14 Jul 2007 16:23:46 -0400, "Rick Rothstein \(MVP - VB\)"
<(E-Mail Removed)> wrote:

>The formula that Gord posted is meant to be placed directly on the
>spreadsheet (no VBA macro is needed for the functionality you asked about).
>The reason it is giving you an error message is you are trying to use it in
>your macro and the internal quote marks are not set up correctly (inside a
>text constant, you need to double up quote marks to produce a single one).
>
>Rick
>
>
>"ezil" <(E-Mail Removed)> wrote in message
>news:C1160E6B-0E11-4638-8D61-(E-Mail Removed)...
>> Thank you MR.Rick and Mr.Gord Dibben
>> The following formula is working and the other one is giving error message
>> myvar= "=countif(a1:a100,""<10"")-countif(a1:a100,""<=5"")"
>>
>>
>> "Rick Rothstein (MVP - VB)" wrote:
>>
>>> > The below formula is working in macro.
>>> > myvar= "=countif(a1:a100,10)"
>>> > but i need to count the cells containing values between less than 10
>>> > and
>>> > greater than
>>> > five? How to change the above formula to incorporate this?
>>>
>>> How about this...
>>>
>>> myvar= "=countif(a1:a100,""<10"")-countif(a1:a100,""<=5"")"
>>>
>>> Note that this excludes 5 and 10 from the range. If you want to include
>>> them, add an equal sign to the '<10' and remove the equal sign from the
>>> '<=5'.
>>>
>>> Rick
>>>
>>>


 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      14th Jul 2007
> Forgot I was in programming group.

Yeah, I think we have all done that a few times (think we're in one group
when actually we're in the other). And, of course, not all OPs post their
questions in the "correct" groups either, which really makes for a confusing
time (whether you are going to answer their question or not; when you move
on to the next post, the previous mis-grouped question makes you think you
are in one group instead of the other).

Rick

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      14th Jul 2007
> Yeah, I think we have all done that a few times (think we're in one group
> when actually we're in the other).


Or, worse, thinking you're in email when you're really in news.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>> Forgot I was in programming group.

>
> Yeah, I think we have all done that a few times (think we're in one group
> when actually we're in the other). And, of course, not all OPs post their
> questions in the "correct" groups either, which really makes for a
> confusing time (whether you are going to answer their question or not;
> when you move on to the next post, the previous mis-grouped question makes
> you think you are in one group instead of the other).
>
> Rick


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting for multiple conditions J. Catz. Microsoft Excel Worksheet Functions 2 11th Dec 2007 11:12 PM
Help with counting multiple conditions =?Utf-8?B?anN0cm8wMQ==?= Microsoft Excel Misc 3 27th Apr 2007 09:50 PM
Excel Help - Counting Multiple Conditions & Multiple Values MAX258 Microsoft Excel Worksheet Functions 7 13th Oct 2003 09:45 PM
Excel Help - Counting Multiple Conditions & Multiple Values MAX258 Microsoft Excel Worksheet Functions 0 13th Oct 2003 07:58 PM
Excel Help - Counting Multiple Conditions & Multiple Values MAX258 Microsoft Excel Worksheet Functions 0 13th Oct 2003 07:58 PM


Features
 

Advertising
 

Newsgroups
 


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