ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   SumIf Question (https://www.excelbanter.com/excel-discussion-misc-queries/217044-sumif-question.html)

Ronda

SumIf Question
 
I have a spreadsheet that I need to do a calculation if the answer is yes or
"Y". I put the formula below in and it works correctly for the "N" formula.
If the answer is "Y" the formula does not give me the sum of F1+G1 (actually
"-" but I put the number in as a negative) but the total of F1 instead.

=SUMIF(H1,"Y",F1:G1)+SUMIF(H1,"N",F1)



Dave Peterson

SumIf Question
 
=sumif()
is usually used to compare a range of values against another value. Then add
the values in the other range.

If you're really only checking H1, maybe just changing your formula would be
easiest:

=if(h1="y",sum(f1:g1),0) + if(h1="n",f1,0)



Ronda wrote:

I have a spreadsheet that I need to do a calculation if the answer is yes or
"Y". I put the formula below in and it works correctly for the "N" formula.
If the answer is "Y" the formula does not give me the sum of F1+G1 (actually
"-" but I put the number in as a negative) but the total of F1 instead.

=SUMIF(H1,"Y",F1:G1)+SUMIF(H1,"N",F1)


--

Dave Peterson

Mike H

SumIf Question
 
Try

=IF(H1="y",SUM(F1:G1),IF(H1="n",G1,""))

Mike

"Ronda" wrote:

I have a spreadsheet that I need to do a calculation if the answer is yes or
"Y". I put the formula below in and it works correctly for the "N" formula.
If the answer is "Y" the formula does not give me the sum of F1+G1 (actually
"-" but I put the number in as a negative) but the total of F1 instead.

=SUMIF(H1,"Y",F1:G1)+SUMIF(H1,"N",F1)




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com