SOLVED

Using SUM to total values produced from IF statements

%3CLINGO-SUB%20id%3D%22lingo-sub-102866%22%20slang%3D%22en-US%22%3EUsing%20SUM%20to%20total%20values%20produced%20from%20IF%20statements%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-102866%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20producing%20a%20questionnaire%20that%20calculates%20a%20score.%20Answers%20to%20questions%20add%20different%20numbers%20of%20points%20to%20the%20score.%20Part%20of%20the%20questionnaire%20is%20Y%2FN%20answers%2C%20but%20others%20have%20a%20rating%20of%201%2C%202%2C%20or%203.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20able%20to%20set%20up%20the%20questions%20with%20the%20score%20for%20a%20yes%20answer%2C%20and%20get%20an%20IF%20statement%20to%20produce%20the%20value%2C%20but%20cannot%20SUM%20the%20point%20subtotal%2Ftotal.%3C%2FP%3E%3CP%3EColumn%20C%20shows%20the%20points%20to%20add%20for%20a%20yes%20answer.%3C%2FP%3E%3CP%3EColumn%20E%20is%20where%20you%20enter%20Y%20or%20N.%3C%2FP%3E%3CP%3EColumn%20F%20uses%20an%20IF%20statement%20(example%3A%20%3DIF(E24%3DYes%2CC24%2C0)%20)to%20show%20the%20points%20for%20a%20Y%20answer.%3C%2FP%3E%3CP%3EF29%20is%20supposed%20to%20add%20the%20subtotal%20for%20column%20F.%20%26nbsp%3BI%20am%20assuming%20the%20IF%20statement%20is%20producing%20the%20value%20as%20Text%20and%20that%20is%20why%20is%20it%20not%20adding.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20is%20the%20best%20way%20to%20do%20what%20I%20want%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-102866%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%20on%20Mac%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-103622%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20SUM%20to%20total%20values%20produced%20from%20IF%20statements%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-103622%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you!%20That%20was%20the%20answer.%20I%20changed%20Column%20C%20to%20numbers%20and%20that%20fixed%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-103348%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20SUM%20to%20total%20values%20produced%20from%20IF%20statements%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-103348%22%20slang%3D%22en-US%22%3E%3CP%3ECathe%3C%2FP%3E%3CP%3EYour%20C%20column%20shows%20a%20green%20triangle%20on%20the%20top%20left%20corner%20of%20each%20cell.%20This%20probably%20indicates%20the%20values%20in%20this%20column%20are%20stored%20as%20Text%20values%20(vs.%20Number).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20IF%20formula%20is%20OK%20but%20as%20it%20takes%20the%20value%20from%20column%20C%20if%20the%20later%20is%20a%20Text%20value%20then%20in%20returns%20that%20Text%20value%20and%20logically%20SUM%20ignores%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESeveral%20options%3A%26nbsp%3BConvert%20the%20values%20in%20column%20C%20to%20Number%20values.%20If%20you%20can't%20change%20your%20formula%20as%20follow%3A%26nbsp%3B%3DIF(E24%3D%22y%22%2CC24%3CSTRONG%3E*1%3C%2FSTRONG%3E%2C0)%26nbsp%3B%3DIF(E24%3D%22y%22%2C%3CSTRONG%3E--%3C%2FSTRONG%3EC24%2C0).%20This%20will%20not%20change%20the%20value%20in%20column%20C%20but%20will%20convert%20it%20to%20a%20Number%20value%20in%20column%26nbsp%3BF%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I am producing a questionnaire that calculates a score. Answers to questions add different numbers of points to the score. Part of the questionnaire is Y/N answers, but others have a rating of 1, 2, or 3.

 

I was able to set up the questions with the score for a yes answer, and get an IF statement to produce the value, but cannot SUM the point subtotal/total.

Column C shows the points to add for a yes answer.

Column E is where you enter Y or N.

Column F uses an IF statement (example: =IF(E24=Yes,C24,0) )to show the points for a Y answer.

F29 is supposed to add the subtotal for column F.  I am assuming the IF statement is producing the value as Text and that is why is it not adding.

 

What is the best way to do what I want?

5 Replies
best response confirmed by Cathe Cleveland (New Contributor)
Solution

Cathe

Your C column shows a green triangle on the top left corner of each cell. This probably indicates the values in this column are stored as Text values (vs. Number).

 

Your IF formula is OK but as it takes the value from column C if the later is a Text value then in returns that Text value and logically SUM ignores it.

 

Several options: Convert the values in column C to Number values. If you can't change your formula as follow: =IF(E24="y",C24*1,0) =IF(E24="y",--C24,0). This will not change the value in column C but will convert it to a Number value in column F

Thank you! That was the answer. I changed Column C to numbers and that fixed it.

 

I was struggling with converting this formula from text to number answer: =IF(F13=1,"15",IF(F13=2,"12",IF(F13=3,"9",IF(F13=4,"6",IF(F13=5,"3",IF(F13=6,"0"))))))
I ended up inserting an adjacent new column to convert the answer to a number using your advice. =G13*1 Then I hid the column with the IF statements to avoid confusion on the answer to use in future calculations. It worked!! Whew - it's a big file.

@LL444L 

 

Your formula can be "simplified" as:

=IF(F13=1,15,IF(F13=2,12,IF(F13=3,9,IF(F13=4,6,IF(F13=5,3,IF(F13=6,0))))))

in which case you shouldn't need an adjacent column with =G13*1

 

If you run Excel > 2016 Or 365, 2 alternatives:

=IFS(F13=1,15, F13=2,12, F13=3,9, F13=4,6, F13=5,3, F13=6,0, TRUE,"Unknown")
=SWITCH(F13, 1,15, 2,12, 3,9, 4,6, 5,3, 6,0, "Unknown")

 

@LL444L 

As variant

=3*(6-F13)