# Discussions

View Only

## If Statement Help

• #### 1.  If Statement Help

Posted 07-30-2018 17:44
I'm trying to write a formula to return a numeric value.
I have 5 numeric fields (Bedroom1, Bedroom2, Bedroom3, etc...) the user will enter in the square footage for each bedroom.

I then have a field where I would like to calculate the number of bedrooms, but only If the value in each of the Bedroom fields is greater than 50 square feet.

• #### 2.  RE: If Statement Help

Posted 07-30-2018 17:50
You can use something like this:

If([Bedroom 1]>49,1,0)+
If([Bedroom 2]>49,1,0)+
If([Bedroom 3]>49,1,0)+
If([Bedroom 4]>49,1,0)

• #### 3.  RE: If Statement Help

Posted 08-08-2018 20:18
Or you could learn about variables and do something simple to start with like this. Not that it is really needed here but it helps learn a bit about variables in formulas.

var number bedone=If([Bedroom1]>49,1,0);
var number bedtwo=If([Bedroom2]>49,1,0);
var number bedthree=If([Bedroom3]>49,1,0);
var number bedfour=If([Bedroom4]>49,1,0);
var number bedfive=If([Bedroom5]>49,1,0);

\$bedone+\$bedtwo+\$bedthree+\$bedfour+\$bedfive