Excel if true statement with add total sum

Copper Contributor

I am trying to write an if or vlookup statement so when i input a value in c2 through c49 and the column j2 through j49 is check it will add the totals to one column in r2.

I am having trouble creating the forumla though.

 

gcb formula.JPG

see attachment.

 

6 Replies

Hello

 

A job for SUMIF() or SUMIFS().

 

How do i account for the check box to be a "true"statement if checked to add the sum?

=sumifs(c2:c49????

Note cell "j2" as the noted checked box.

@Admin Clayton, despite the checkbox showing in J2, a check box is not automatically associated with the cell that it is underneath it. 

 

In a scenario like the screenshot above, I would strongly advise against using check boxes, precisely because of that. Check boxes are graphical objects that float above the Excel grid, much like placing a transparent film over a piece of paper. When you write with a marker on the transparent film, you don't place any marks on the actual paper sheet.

 

Assuming that these check boxes are Form controls (as opposed to Active X controls), you need to bind each control to a worksheet cell. Setting up each check box with an associated cell will be a lot of work in a spreadsheet like the one in the screenshot. You need to right-click and edit the properties of each check box. On the Control tab you need to assign the check box a worksheet cell where the checkbox state will be saved.

 

2017-05-09_11-55-19.png

 

 

 

Now when you tick a check box, the corresponding cell will show TRUE and you can use a Sumif or Sumifs formula to create a sum for only the checked items. 

 

 

 

2017-05-09_11-54-55.png

 

Check boxes were not designed as interaction tools for worksheets. If you use them like that, you need to be aware of these shortcomings and workarounds. 

 

If you want the appearance of a tick or a cross, you could use the font Marlett, which shows the letters a or b as a tick mark and the letter r as a cross.  In the following screenshot you can see that column F has been formatted with Marlett and the letters r or a have been entered as values. These entries can be used in a Sumif or Sumifs formula without any further ado. 

 

2017-05-09_14-24-41.png

 

 

I am intermediate on sumifs.  I would prefer not to use the check boxes and convert it back over.

If i take the other route and use the ticks how would the sumifs forumla look for what I am trying to accomplish?

=sumifs(c2:c49????) to get the total in column s?

 

Well, the text in the cell is a or r, just the font displays it as a tick or cross. So, if you use the "a", the Sumif or Sumifs needs to check the column for "a".

 

Sumif has the syntax Sumif(range, condition, [sum range]), so if you want to sum the values in column C for those rows where column E has the value "a", you need 

 

=Sumif(E:E,"a",C:C)

 

Using Sumifs you can have more than one condition. The syntax is Sumifs(sum range, criteria range1, criteria1, criteria range x, criteria x,...). So you would use

 

=Sumifs(C:C,E:E,"a",F:F,"a")

 

This will total all values in column C where column E has an "a" and column F also has an "a" in the same row.

 

Does that make it clearer?