# Excel, help with if statement

• MaxManus
In summary, to use the IF statement in Excel, select the cell where you want the result, type "=IF(" followed by the condition, specify what to do if the condition is met and not met, and press enter. The syntax for the IF statement is "=IF(logical_test, value_if_true, value_if_false)". Multiple IF statements can be nested using the syntax "=IF(logical_test, value_if_true, IF(logical_test, value_if_true, value_if_false))". The "AND" and "OR" functions can be used to evaluate multiple conditions within an IF statement. The IF statement can also be used to format cells in Excel using the conditional formatting feature.

#### MaxManus

Regression in Excel

I want to make an regression of some data, but I only want to use some of the data. The data I want use is where Vacant = 1.
Is this possible in excel?

I have tried to use the if-function but the regression does not like "false"

I want to make a regression of Price = B1 + B2*sqft for the vacant houses.

#### Attachments

• stockton2.xls
76 KB · Views: 246
Last edited:
Excel is mostly hands-on

The simple solution is sort on the vacancy column and then graph the data with vacancy=1 using scatter plot.
This would be the result: price = 69.9 SQFT - 4793

#### Attachments

• stockton2(1).xls
93 KB · Views: 269
Thanks.

## 1. How do I use the IF statement in Excel?

To use the IF statement in Excel, you must first select the cell where you want the result to be displayed. Then, type "=IF(" into the formula bar followed by the condition or statement you want to evaluate. Next, enter a comma and specify what you want to happen if the condition is met, followed by another comma. Finally, specify what you want to happen if the condition is not met and close the parentheses. Press enter to complete the formula.

## 2. What is the syntax for the IF statement in Excel?

The syntax for the IF statement in Excel is "=IF(logical_test, value_if_true, value_if_false)". The "logical_test" is the condition or statement that is being evaluated. The "value_if_true" is what will happen if the condition is met, and the "value_if_false" is what will happen if the condition is not met.

## 3. Can I use multiple IF statements in one cell in Excel?

Yes, you can use multiple IF statements in one cell in Excel. This is known as a nested IF statement. To do this, you would use the syntax "=IF(logical_test, value_if_true, IF(logical_test, value_if_true, value_if_false))". You can continue nesting IF statements as needed.

## 4. How do I use the "AND" or "OR" functions in an IF statement in Excel?

You can use the "AND" or "OR" functions within an IF statement in Excel to evaluate multiple conditions. To use the "AND" function, you would enter "=IF(AND(logical_test1, logical_test2), value_if_true, value_if_false)". To use the "OR" function, you would enter "=IF(OR(logical_test1, logical_test2), value_if_true, value_if_false)".

## 5. Can I use the IF statement to format cells in Excel?

Yes, you can use the IF statement to format cells in Excel. To do this, you would use the conditional formatting feature. Select the cells you want to format, then go to the "Home" tab and click on "Conditional Formatting". From there, select "New Rule" and choose the option "Use a formula to determine which cells to format". Enter your IF statement as the formula, and then select the formatting you want to apply if the condition is met.