Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default COUNTIF a value within a range equals any value in an array/list

I'm not sure if COUNTIF is the correct function, but I've tried many
different functions and combinations of functions but can't seem to get the
result I want.

I have a column that contains multiple user id's from 2 different sites
(with duplicates). **Also, the column is on a separate sheet** I have a
list/array named "ID" that contains only the user ID's from my site.**on the
current sheet** I want to count the number of files my site completed by
searching the values in column C of sheet 2, comparing them to the values in
"ID" and add them.
So, if the value of USER ID is in "ID", add to the counter.

Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default COUNTIF a value within a range equals any value in an array/list

Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

Where ID = list/array named "ID" that contains only the user ID's from my
site

--
Biff
Microsoft Excel MVP


"sweens319" wrote in message
...
I'm not sure if COUNTIF is the correct function, but I've tried many
different functions and combinations of functions but can't seem to get
the
result I want.

I have a column that contains multiple user id's from 2 different sites
(with duplicates). **Also, the column is on a separate sheet** I have a
list/array named "ID" that contains only the user ID's from my site.**on
the
current sheet** I want to count the number of files my site completed by
searching the values in column C of sheet 2, comparing them to the values
in
"ID" and add them.
So, if the value of USER ID is in "ID", add to the counter.

Can anyone help?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default COUNTIF a value within a range equals any value in an array/list

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default COUNTIF a value within a range equals any value in an array/li

That worked perfectly. Thank you so much. I knew there was a reason I keep
the "Discussion Groups Home" in my Favorites list at work. I'm always able to
find or get the answers I need.

"T. Valko" wrote:

Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

Where ID = list/array named "ID" that contains only the user ID's from my
site

--
Biff
Microsoft Excel MVP


"sweens319" wrote in message
...
I'm not sure if COUNTIF is the correct function, but I've tried many
different functions and combinations of functions but can't seem to get
the
result I want.

I have a column that contains multiple user id's from 2 different sites
(with duplicates). **Also, the column is on a separate sheet** I have a
list/array named "ID" that contains only the user ID's from my site.**on
the
current sheet** I want to count the number of files my site completed by
searching the values in column C of sheet 2, comparing them to the values
in
"ID" and add them.
So, if the value of USER ID is in "ID", add to the counter.

Can anyone help?




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default COUNTIF a value within a range equals any value in an array/li

Not sure why, but the "faster" one didn't work. I still got a value of zero.
Thankfully, the original function (sumproduct) worked exactly like I hoped.
Thank you both for your willingness to help.

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default COUNTIF a value within a range equals any value in an array/li

Hi, sweens319

Harlan mentioned that =COUNT(MATCH(Sheet2!C1:C100,ID,0))
is an ARRAY FORMULA.

That means you commit the formula by holding down Ctrl and Shift when you
press Enter, instead of just pressing Enter.
(It's often abbreviated as C+S+E)

When you do that, Excel will but braces around the formula {your_formula}
and it will return the correct value.

Note: You can just type the braces yourself.....you need to let Excel put
them in for you.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"sweens319" wrote in message
...
Not sure why, but the "faster" one didn't work. I still got a value of
zero.
Thankfully, the original function (sumproduct) worked exactly like I
hoped.
Thank you both for your willingness to help.

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe
the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.





  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default COUNTIF a value within a range equals any value in an array/li

Now, say I'm using the first function

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

The next column over is a number (elapsed time). How would I change this and
add to it if I want to count all the occurrences of My Site User ID's that
have an elapsed time of 180?

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default COUNTIF a value within a range equals any value in an array/li

Yikes! Typo!

This
Note: You can just type the braces yourself.....you need to let Excel put
them in for you.


Should be:
Note: You CANNOT just type the braces yourself......you need to let Excel
put
them in for you.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)

"Ron Coderre" wrote in message
...
Hi, sweens319

Harlan mentioned that =COUNT(MATCH(Sheet2!C1:C100,ID,0))
is an ARRAY FORMULA.

That means you commit the formula by holding down Ctrl and Shift when you
press Enter, instead of just pressing Enter.
(It's often abbreviated as C+S+E)

When you do that, Excel will but braces around the formula {your_formula}
and it will return the correct value.

Note: You can just type the braces yourself.....you need to let Excel put
them in for you.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"sweens319" wrote in message
...
Not sure why, but the "faster" one didn't work. I still got a value of
zero.
Thankfully, the original function (sumproduct) worked exactly like I
hoped.
Thank you both for your willingness to help.

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))
....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe
the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.







  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,480
Default COUNTIF a value within a range equals any value in an array/li

Hi

Harlan said the faster formula was an array formula, which needs to be
entered (or amended) using Control+Shift+Enter (CSE), not just Enter.

When you use CSE, Excel will insert curly braces around the formula { }
{=COUNT(MATCH(Sheet2!C1:C100,ID,0))}

I suspect you just used Enter.

--
Regards
Roger Govier



"sweens319" wrote in message
...
Not sure why, but the "faster" one didn't work. I still got a value of
zero.
Thankfully, the original function (sumproduct) worked exactly like I
hoped.
Thank you both for your willingness to help.

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe
the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.





  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,480
Default COUNTIF a value within a range equals any value in an array/li

Hi
You could go back to Biff's original formula, and add another condition.

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))),
--(Sheet2!$D1:D100180))

assuming your elapsed times are in column D
--
Regards
Roger Govier



"sweens319" wrote in message
...
Now, say I'm using the first function

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

The next column over is a number (elapsed time). How would I change this
and
add to it if I want to count all the occurrences of My Site User ID's that
have an elapsed time of 180?

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe
the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.







  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default COUNTIF a value within a range equals any value in an array/li

Awesome! That works for the number column, but what if I have a text column,
like in my other post?

A B
XYZ Yes
XYZ No
ABC No
LMN Yes
ABC Yes
LMN No

I tried ISTEXT with Sheet2!$D1:D100="Yes"
but that returns a zero.


"Roger Govier" wrote:

Hi
You could go back to Biff's original formula, and add another condition.

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))),
--(Sheet2!$D1:D100180))

assuming your elapsed times are in column D
--
Regards
Roger Govier



"sweens319" wrote in message
...
Now, say I'm using the first function

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

The next column over is a number (elapsed time). How would I change this
and
add to it if I want to count all the occurrences of My Site User ID's that
have an elapsed time of 180?

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))
....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe
the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.






  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default COUNTIF a value within a range equals any value in an array/li

It doesn't matter, ISNUMBER in this formula has nothing to do with the
contents of the cells


--


Regards,


Peo Sjoblom



"sweens319" wrote in message
...
Awesome! That works for the number column, but what if I have a text
column,
like in my other post?

A B
XYZ Yes
XYZ No
ABC No
LMN Yes
ABC Yes
LMN No

I tried ISTEXT with Sheet2!$D1:D100="Yes"
but that returns a zero.


"Roger Govier" wrote:

Hi
You could go back to Biff's original formula, and add another condition.

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))),
--(Sheet2!$D1:D100180))

assuming your elapsed times are in column D
--
Regards
Roger Govier



"sweens319" wrote in message
...
Now, say I'm using the first function

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

The next column over is a number (elapsed time). How would I change
this
and
add to it if I want to count all the occurrences of My Site User ID's
that
have an elapsed time of 180?

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))
....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe
the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.








  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default COUNTIF a value within a range equals any value in an array/li

Yeah. I figured that out. I'm just an idiot. I forgot to change the column
reference. It all works great!

"Peo Sjoblom" wrote:

It doesn't matter, ISNUMBER in this formula has nothing to do with the
contents of the cells


--


Regards,


Peo Sjoblom



"sweens319" wrote in message
...
Awesome! That works for the number column, but what if I have a text
column,
like in my other post?

A B
XYZ Yes
XYZ No
ABC No
LMN Yes
ABC Yes
LMN No

I tried ISTEXT with Sheet2!$D1:D100="Yes"
but that returns a zero.


"Roger Govier" wrote:

Hi
You could go back to Biff's original formula, and add another condition.

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))),
--(Sheet2!$D1:D100180))

assuming your elapsed times are in column D
--
Regards
Roger Govier



"sweens319" wrote in message
...
Now, say I'm using the first function

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

The next column over is a number (elapsed time). How would I change
this
and
add to it if I want to count all the occurrences of My Site User ID's
that
have an elapsed time of 180?

"Harlan Grove" wrote:

"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))
....

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe
the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.









  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default COUNTIF a value within a range equals any value in an array/li

"sweens319" wrote...
Now, say I'm using the first function

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

The next column over is a number (elapsed time). How would I change this
and add to it if I want to count all the occurrences of My Site User ID's
that have an elapsed time of 180?

....

If none of your user IDs would be blank, you could change this to the array
formula

=SUM(COUNTIF(ID,IF(Sheet2!D1:D100180,Sheet2!C1:C1 00,"")))

or adapt the other array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0)/(Sheet2!D1:D100180))


  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default COUNTIF a value within a range equals any value in an array/list

Out of curiosity I ran some tests.

The array formula is slightly faster than SUMPRODUCT(--(ISNUMBER(MATCH. The
difference may not be significant but the array formula is also shorter.

=SUMPRODUCT(COUNTIF is "significantly" slower than either of the other 2.

http://img67.imageshack.us/img67/5091/calctimes3ki4.jpg

Calculation Timer code by Charles Williams:

http://msdn2.microsoft.com/en-us/library/aa730921.aspx

--
Biff
Microsoft Excel MVP


"Harlan Grove" wrote in message
...
"T. Valko" wrote...
Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(Sheet2!C1:C100,ID,0))))

...

If recalc speed isn't essential,

=SUMPRODUCT(COUNTIF(ID,Sheet2!C1:C100))

should return the same result. If recalc speed is essential, I believe the
array formula

=COUNT(MATCH(Sheet2!C1:C100,ID,0))

would be faster.



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 do I create a CountIF statement for a range of items in a list CraigC Excel Worksheet Functions 1 March 7th 07 07:21 PM
if specific value from list A equals one of the values from list b... broer konijn Excel Worksheet Functions 7 June 14th 06 06:28 AM
if a:a (range) equals january and c:c equals gas then add g:g ($) BCOz Excel Worksheet Functions 4 December 29th 05 07:40 PM
If statement where the logical test is a range that equals a word Steve o Excel Worksheet Functions 8 June 27th 05 02:43 PM
Countif Text equals the same tamato43 Excel Discussion (Misc queries) 1 March 31st 05 01:24 AM


All times are GMT +1. The time now is 11:54 AM.

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"