Sounds like an excercise in binary numbers...
You must (at least mentally) assign a binary value (1, 2, 4, 8, 16, ...) to each checkbox. To get the total value you just add the values of the checked checkboxes. If no box is checked the total will be 0, if the ones with weight 1 and 2 are checked the total will be 3 etc. The maximum total will be 255 for 8 checkboxes (1+2+4+8+16+32+64+128).
Conversely, if you have a total value and want to find out which checkboxes will have to be checked then divide the total by each checkbox value and see if the result is 0 (checkbox not checked) or not (checkbox checked).
Assigning a binary value to each checkbox is quite easy if you put the eight checkboxes into an array[0..7]. If the number 1 is left-shifted (shl) by the array index of a checkbox you'll get its binary value.
A working example is in the attachment. It just displays the resulting total, it does not store it in a database.