Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Counting a specific number only if an adjacent cell has something

Hi,

I am trying to work out how to use if and count if to count the number of
cells with a certain number in, but only if a cell in an adjacent coloumn has
something in it. If statements don't seem to take ranges for its logical
test, and countif doesn't seem to want to allo me to define the criteria as,
cell=1 AND adjacent cell < 0

My data is something like

1 100
1
1 15
2
2 67
1 34
3 82
3
2
3 43

I want to get a readout of the number of 1's that have something in adjacent
coloumn.

Thanks in advance

Hugsie
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Counting a specific number only if an adjacent cell has something


Try

=SUMPRODUCT(--(A1:A100=1),--(B1:B100<""))


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=567420

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Counting a specific number only if an adjacent cell has something

where col g is the adjacent cell
count non blanks in g
=COUNTIF(G1:G21,"<")
sum g for 1 in col f
=SUMPRODUCT(--(F1:F21=1),--G1:G21)
count f for numbers in g
=SUMPRODUCT(--(F1:F21=1),--ISNUMBER(G1:G21))
--
Don Guillett
SalesAid Software

"Hugsie Bear" wrote in message
...
Hi,

I am trying to work out how to use if and count if to count the number of
cells with a certain number in, but only if a cell in an adjacent coloumn
has
something in it. If statements don't seem to take ranges for its logical
test, and countif doesn't seem to want to allo me to define the criteria
as,
cell=1 AND adjacent cell < 0

My data is something like

1 100
1
1 15
2
2 67
1 34
3 82
3
2
3 43

I want to get a readout of the number of 1's that have something in
adjacent
coloumn.

Thanks in advance

Hugsie



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 138
Default Counting a specific number only if an adjacent cell has something

How about making a new column with the following:

if(and(a1=1,not(isblank(b1))),1,0)

and then just get the sum of this column?

Cheers,
Jonathan

"Hugsie Bear" wrote:

Hi,

I am trying to work out how to use if and count if to count the number of
cells with a certain number in, but only if a cell in an adjacent coloumn has
something in it. If statements don't seem to take ranges for its logical
test, and countif doesn't seem to want to allo me to define the criteria as,
cell=1 AND adjacent cell < 0

My data is something like

1 100
1
1 15
2
2 67
1 34
3 82
3
2
3 43

I want to get a readout of the number of 1's that have something in adjacent
coloumn.

Thanks in advance

Hugsie

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Counting a specific number only if an adjacent cell has someth

Thanks daddy,

I worked it out with some lateral thinking and used

{=sum(if(range1=1, if(range2 <"" , 1 , 0) ) ) } which seemed to work

thanks for your help

Hugsie
"daddylonglegs" wrote:


Try

=SUMPRODUCT(--(A1:A100=1),--(B1:B100<""))


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=567420




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Counting a specific number only if an adjacent cell has something


OK, but I'd suggest that SUMPRODUCT is a tad simpler, it doesn't require
CTRL+SHIFT+ENTER for example.

If you want to use an array formula you can shorten to

{=sum((range1=1)*(range2 <""))}


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=567420

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
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 1 July 11th 06 04:29 PM
Instead of a negative number, I'd like to show zero... Dr. Darrell Excel Worksheet Functions 6 December 7th 05 08:21 PM
how to format only a specific character or number in each cell withina range of cells Colleen Excel Worksheet Functions 1 September 12th 05 05:44 PM
Count Number of Characters in a cell? AHJuncti Excel Discussion (Misc queries) 2 June 16th 05 07:39 PM
Counting specific text in a cell Steve Excel Worksheet Functions 7 January 26th 05 05:51 PM


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