# How to calculate a question by adding conditions as well as error messages if conditions are not met

Good morning all
delighted to be part of the community
My issue is the following:
data
1.question A (Total number of beneficiaries)
2.question B already participated in this topic
3. question C 1st participation
4.question D number of men
5.question E number of women
6.question F number of host
7.question G number of refugees

I would like to integrate the following conditions:
= (IF (AND (SUM (question B: question C) = question A; SUM (question D: question E) = question A); IF (AND (SUM (question F: question G) = question A); "Not error “;” Error ")))

Welcome to the community, @CharlesBARA! Would you also mind sharing your requirement in a descriptive form so that the community could know what you intend to see?

Here is my attached file I do not know how to go about integrating its conditions

I would just like these questions to have a logical sequence and a coherent one so as to display an error message if the conditions are not respected

Sorry @CharlesBARA, could you also describe your conditions? We are still unaware about the conditions that you require.

I would like to:
The sum of B + C (integer: Have already participated in this theme + 1st participation in this theme: either equal to A (integer: Total number of participants) and that the sum of D + E = A and that the sum of F + G equal to A
if this condition is not respected during data entry, the questionnaire must display a mandatory error message

Thank

cordially

You could do this as discussed in our previous post:

#### Second approach:

Thank you very much

I try and I give you feedback

cordially

1 Like

Good evening the community
I almost got the coding done it works fine with the first 3 lines. <= \$ {A}
= (\$ {A} - \$ {B})
<= \$ {A}
but does not work for the following: <= (\$ {A} - \$ {D})
= (\$ {A}
<= (\$ {A} - \$ {F})
By following the same logic