Adding multiple cell values using check box true/false

kares

New Member
Joined
Dec 10, 2024
Messages
7
Office Version
  1. 2019
Platform
  1. Windows
It's me again.

I am trying to add multiple cell values using the checkbox. As you can see in the attached file, I am trying to combine the cell values of those in the color red but I am having a rough time when I try to tick BOTH checkboxes as it doesn't calculate the total amount for all those in color red.
 

Attachments

  • Screenshot 2024-12-10 215632.jpg
    Screenshot 2024-12-10 215632.jpg
    37.3 KB · Views: 7

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hello,

I did not understand very well which checkbox corresponds to which value. However, you can multiply values by a boolean (TRUE/FALSE), as TRUE=1 and FALSE=0.

So in your screenshot, let's say if checkbox[C3-D3] corresponds to "adding values in A4:A6", and checkbox[C8-D8] to " adding values in A7:A8"
You can get the total via:
Excel Formula:
=SUM(A4:A6)*D3 + SUM(A7:A8)*D8

If you add many checkboxes,, you should use SUMPRODUCT on the same principle, adding a column of TRUE/FALSE next to the values to SUM.
 
Upvote 0
If you want to add both those together, your two IFs should be added together, not one imbedded inside the other, i.e. structured like this:
Excel Formula:
=IF(...) + IF(...)
If that is not what you are looking for, please let us know the expected value of your example.
 
Upvote 0
Apologies for the confusion, I was just so confused awhile ago.

So the context here is, when I tick the checkbox in C3 only, it should add the values in B2, A4 & A7.

Then if I tick the 2nd checkbox in C8 only, it should add B2 & A9 only.

the value in B2 is the primary value that needs to be added along with the other values that is in colored red.

Lastly, if I tick BOTH checkboxes, I would like to add all the cell values in B2, A4, A7 & A9.
 
Upvote 0
Try this formula:
Excel Formula:
=IF(D3+D8,B2,0)+(D3*(A4+A7))+(D8*A9)

In your example,
- if only D3 is TRUE, it returns 55
- if only D8 is TRUE, it returns 58
- if both D3 and D8 are true, it returns 63

Note that if you are only using the red text to show us what values should be added, this should work.
If the red text can change, and you want the formula to actually look at the color of the text to determine which cells to add, that is a whole different story, and we will need more information on what is turning the cells red.
 
Upvote 0
Assuming the value of the checkboxes are in their respective cells, the formula below should work
Excel Formula:
=OR(C3,C8)*B2 + C3*(A4+A7) + C8*A9
If they are linked to the cells in D, then replace "C" by "D" in formula.
 
Upvote 0
Try this formula:
Excel Formula:
=IF(D3+D8,B2,0)+(D3*(A4+A7))+(D8*A9)

In your example,
- if only D3 is TRUE, it returns 55
- if only D8 is TRUE, it returns 58
- if both D3 and D8 are true, it returns 63

Note that if you are only using the red text to show us what values should be added, this should work.
If the red text can change, and you want the formula to actually look at the color of the text to determine which cells to add, that is a whole different story, and we will need more information on what is turning the cells red.
There is actually no code nor any formula used to turn those cell values into red. I just used red for emphasis. The attachment is like a dummy/test of what I want to achieve on the actual worksheet.
 
Upvote 0
Assuming the value of the checkboxes are in their respective cells, the formula below should work
Excel Formula:
=OR(C3,C8)*B2 + C3*(A4+A7) + C8*A9
If they are linked to the cells in D, then replace "C" by "D" in formula.
Thank you so much! This has solved my problem! Have a great day!
 
Upvote 0
Try this formula:
Excel Formula:
=IF(D3+D8,B2,0)+(D3*(A4+A7))+(D8*A9)

In your example,
- if only D3 is TRUE, it returns 55
- if only D8 is TRUE, it returns 58
- if both D3 and D8 are true, it returns 63

Note that if you are only using the red text to show us what values should be added, this should work.
If the red text can change, and you want the formula to actually look at the color of the text to determine which cells to add, that is a whole different story, and we will need more information on what is turning the cells red.
thank you! I just replaced "0" with B2 as I want its value to appear by itself when there are no checkboxes ticked.
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,083
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top