Forum Discussion

Alison Flynn's avatar
Alison Flynn
Brass Contributor
Apr 25, 2018

Problem with Formula

Hey guys,

I've a wee problem with a formula as follows:

Looking for this result: BMI > 30 or WC > 40 (men), 35 (women)

So if column 'BMI’ >30 and / or column ‘Waist Cir’ >40 if column ‘Gender’ is ‘M’ or >35 if column ‘Gender’ is ‘F’ then the value = 1, otherwise = zero

The formula I'm using is: IF(AND(O3≥40, D3="M"), 1, 0)+IF(AND(O3≥35, D3="F"), 1, 0)+IF(N3≥30, 1, 0).  This is mostly giving the right answer, however, I'm looking for an answer of either 1 or zero.  This formula can give a 2.  Example: BMI 35; WC 42, Gender M = 2.

I think the problem is that there is a '+' before the 3rd part, and think that's causing the addition, however if I put in a comma or AND or OR errors are showing.  

Any ideas how I can correct it please?

Thanks in anticipation!

Gender

BMI

Waist Cir

Obesity RF

F

29

36

1

M

35

42

2

 

 

 

0

 

  • Hi,

     

    Please try this formula instead:

    =IF(AND(O3>40, D3="M"), 1,IF(AND(O3>35, D3="F"), 1,IF(N3>30, 1, 0)))

    This syntax is called (Nested IF).

    I think that this is what you looking for!

     

    Regards

  • Haytham Amairah's avatar
    Haytham Amairah
    Silver Contributor

    Hi,

     

    Please try this formula instead:

    =IF(AND(O3>40, D3="M"), 1,IF(AND(O3>35, D3="F"), 1,IF(N3>30, 1, 0)))

    This syntax is called (Nested IF).

    I think that this is what you looking for!

     

    Regards

    • Alison Flynn's avatar
      Alison Flynn
      Brass Contributor

      Wonderful, it worked perfectly!  Thanks a million, Much appreciated.

Resources