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 » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Countif Range not working



 
 
Thread Tools Display Modes
  #1  
Old August 1st, 2008, 04:51 PM posted to microsoft.public.excel.worksheet.functions
tommcbrny
external usenet poster
 
Posts: 68
Default Countif Range not working

Hi,

I have the following entered to set a text value in column d when some other
text value is found in a cell range within columns b and c:

=IF(COUNTIF(B49:C49,"*aaa*")0,"mgr1",IF(COUNTIF(B 49,"*bbb*")0,"mgr1",IF(COUNTIF(B49,"*ccc*")0,"mg r1",IF(COUNTIF(B49,"*ddd*")0,"mgr1",IF(COUNTIF(B4 9,"*eee*")0,"mgr2",IF(COUNTIF(B49,"*fff*")0,"mgr 2","Other"))))))

This works as intended for any value containined in cells of column b, but
only works for the very first value ("aaa") in column c. In other words, if
the value of a cell within range for column c is "bbb", "Other" is returned
instead of "mgr1".

Can anyone tell me what I am doing wrong? Is there a way to have the
formula evaluate each value for both columns?

Thanks,

Tom
  #2  
Old August 1st, 2008, 05:05 PM posted to microsoft.public.excel.worksheet.functions
Glenn[_6_]
external usenet poster
 
Posts: 1,245
Default Countif Range not working

tommcbrny wrote:
Hi,

I have the following entered to set a text value in column d when some other
text value is found in a cell range within columns b and c:

=IF(COUNTIF(B49:C49,"*aaa*")0,"mgr1",IF(COUNTIF(B 49,"*bbb*")0,"mgr1",IF(COUNTIF(B49,"*ccc*")0,"mg r1",IF(COUNTIF(B49,"*ddd*")0,"mgr1",IF(COUNTIF(B4 9,"*eee*")0,"mgr2",IF(COUNTIF(B49,"*fff*")0,"mgr 2","Other"))))))

This works as intended for any value containined in cells of column b, but
only works for the very first value ("aaa") in column c. In other words, if
the value of a cell within range for column c is "bbb", "Other" is returned
instead of "mgr1".

Can anyone tell me what I am doing wrong? Is there a way to have the
formula evaluate each value for both columns?

Thanks,

Tom



You aren't referencing column C for "bbb".
  #3  
Old August 1st, 2008, 05:10 PM posted to microsoft.public.excel.worksheet.functions
Bob Phillips
external usenet poster
 
Posts: 5,994
Default Countif Range not working

Works fine here Tom, which suggests a data problem to me.

BTW, you can reduce the formula to

=IF(SUM(COUNTIF(B49:C49,{"*aaa*","*bbb*","*ccc*"," *ddd*"})),"mgr1",IF(SUM(COUNTIF(B49,{"*eee*","*fff *"})),"mgr2","Other")))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"tommcbrny" wrote in message
...
Hi,

I have the following entered to set a text value in column d when some
other
text value is found in a cell range within columns b and c:

=IF(COUNTIF(B49:C49,"*aaa*")0,"mgr1",IF(COUNTIF(B 49,"*bbb*")0,"mgr1",IF(COUNTIF(B49,"*ccc*")0,"mg r1",IF(COUNTIF(B49,"*ddd*")0,"mgr1",IF(COUNTIF(B4 9,"*eee*")0,"mgr2",IF(COUNTIF(B49,"*fff*")0,"mgr 2","Other"))))))

This works as intended for any value containined in cells of column b, but
only works for the very first value ("aaa") in column c. In other words,
if
the value of a cell within range for column c is "bbb", "Other" is
returned
instead of "mgr1".

Can anyone tell me what I am doing wrong? Is there a way to have the
formula evaluate each value for both columns?

Thanks,

Tom



  #4  
Old August 1st, 2008, 05:11 PM posted to microsoft.public.excel.worksheet.functions
tommcbrny
external usenet poster
 
Posts: 68
Default Countif Range not working

Oh wow, that is AWFUL proof reading on my part, sorry for the dumb post and
thanks Glenn for pointing out the error.
Tom

"Glenn" wrote:

tommcbrny wrote:
Hi,

I have the following entered to set a text value in column d when some other
text value is found in a cell range within columns b and c:

=IF(COUNTIF(B49:C49,"*aaa*")0,"mgr1",IF(COUNTIF(B 49,"*bbb*")0,"mgr1",IF(COUNTIF(B49,"*ccc*")0,"mg r1",IF(COUNTIF(B49,"*ddd*")0,"mgr1",IF(COUNTIF(B4 9,"*eee*")0,"mgr2",IF(COUNTIF(B49,"*fff*")0,"mgr 2","Other"))))))

This works as intended for any value containined in cells of column b, but
only works for the very first value ("aaa") in column c. In other words, if
the value of a cell within range for column c is "bbb", "Other" is returned
instead of "mgr1".

Can anyone tell me what I am doing wrong? Is there a way to have the
formula evaluate each value for both columns?

Thanks,

Tom



You aren't referencing column C for "bbb".

  #5  
Old August 1st, 2008, 05:29 PM posted to microsoft.public.excel.worksheet.functions
tommcbrny
external usenet poster
 
Posts: 68
Default Countif Range not working

Thanks for the consolidation Bob, very useful!

"Bob Phillips" wrote:

Works fine here Tom, which suggests a data problem to me.

BTW, you can reduce the formula to

=IF(SUM(COUNTIF(B49:C49,{"*aaa*","*bbb*","*ccc*"," *ddd*"})),"mgr1",IF(SUM(COUNTIF(B49,{"*eee*","*fff *"})),"mgr2","Other")))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"tommcbrny" wrote in message
...
Hi,

I have the following entered to set a text value in column d when some
other
text value is found in a cell range within columns b and c:

=IF(COUNTIF(B49:C49,"*aaa*")0,"mgr1",IF(COUNTIF(B 49,"*bbb*")0,"mgr1",IF(COUNTIF(B49,"*ccc*")0,"mg r1",IF(COUNTIF(B49,"*ddd*")0,"mgr1",IF(COUNTIF(B4 9,"*eee*")0,"mgr2",IF(COUNTIF(B49,"*fff*")0,"mgr 2","Other"))))))

This works as intended for any value containined in cells of column b, but
only works for the very first value ("aaa") in column c. In other words,
if
the value of a cell within range for column c is "bbb", "Other" is
returned
instead of "mgr1".

Can anyone tell me what I am doing wrong? Is there a way to have the
formula evaluate each value for both columns?

Thanks,

Tom




 




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


All times are GMT +1. The time now is 06:15 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.