Filtering selected option

hi i would like to enquire about data filtering. for example a target of 8 observation is required n only S and B will be allowed to hit this target. for anyone who have Q observation the target difference would not be deducted but will be in a total column. For S and B, difference in target will be deducted and will be in S+B and total column. how do i go about this as right now my Q is being deducted in difference and added to S+B column?