#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default how do I...

Hi all
In column A I have numbers
In column B I have two values : "Yes"/"No"
I want C1 to contain SUM(A) but only if B has "Yes"

e,g,

A B C
1 Y 5
2 N
4 Y

TIA
Guy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default how do I...

=sumif(b:b,"y",a:a)
or
=sumif(b:b,"yes",a:a)

You wrote yes/no in the text, but you used y/n in the sample???



Guy Cohen wrote:

Hi all
In column A I have numbers
In column B I have two values : "Yes"/"No"
I want C1 to contain SUM(A) but only if B has "Yes"

e,g,

A B C
1 Y 5
2 N
4 Y

TIA
Guy


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default how do I...

Thanks a lot dave
Worked for me :)
Guy
"Dave Peterson" wrote in message
...
=sumif(b:b,"y",a:a)
or
=sumif(b:b,"yes",a:a)

You wrote yes/no in the text, but you used y/n in the sample???



Guy Cohen wrote:

Hi all
In column A I have numbers
In column B I have two values : "Yes"/"No"
I want C1 to contain SUM(A) but only if B has "Yes"

e,g,

A B C
1 Y 5
2 N
4 Y

TIA
Guy


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default how do I...

Type this formula into any cell in column c.

=sumif(b:b,"Yes",a:a)

This works on the entire column, so there is no need to define row numbers.

If, say for example, you wanted to specify a defined range (say) rows 1 to 100
the code would be:

=sumif(b1:b100,"Yes",a1:a100)


BerbatovIsGod


"Guy Cohen" wrote:

Hi all
In column A I have numbers
In column B I have two values : "Yes"/"No"
I want C1 to contain SUM(A) but only if B has "Yes"

e,g,

A B C
1 Y 5
2 N
4 Y

TIA
Guy



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default how do I...

Sorry, if you have Y/N in column b it should be "=Y" or "=N" in the formula
--
BerbatovIsGod


"PaxtonRoadEnd" wrote:

Type this formula into any cell in column c.

=sumif(b:b,"Yes",a:a)

This works on the entire column, so there is no need to define row numbers.

If, say for example, you wanted to specify a defined range (say) rows 1 to 100
the code would be:

=sumif(b1:b100,"Yes",a1:a100)


BerbatovIsGod


"Guy Cohen" wrote:

Hi all
In column A I have numbers
In column B I have two values : "Yes"/"No"
I want C1 to contain SUM(A) but only if B has "Yes"

e,g,

A B C
1 Y 5
2 N
4 Y

TIA
Guy





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 207
Default how do I...

Guy Cohen,
Use "SumIF" function:
"=SumIF(B1:B3),"Yes",A1:A3)"
where B1 is equal to the first answer column, B3 is the last answer in
column.
"Yes" is the desired response to count.
A1 is the first value to add in column, A3 is last value to add.

hth
:-)

"Guy Cohen" wrote:

Hi all
In column A I have numbers
In column B I have two values : "Yes"/"No"
I want C1 to contain SUM(A) but only if B has "Yes"

e,g,

A B C
1 Y 5
2 N
4 Y

TIA
Guy



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



All times are GMT +1. The time now is 05:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"