# IF Statement

#### mwf3

##### New Member
I have 3 cells, columns A,B,C. The first 2 cells, A,B should BOTH have a number >0 in order for column C to calculate the formula, otherwise "-".

I started by creating this =IF(A1>1,"-",IF(B1>1,"-",B1/A1)

I am envisioning an "AND" statement to say A1 AND B1 >1

I have tried to figure this out and is probably something very simple.

Mark

### Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

#### barry houdini

##### MrExcel MVP
Try

=IF((A1>0)*(B1>0),B1/A1,"-")

#### Crow_23

##### Board Regular
Code:
``=IF(AND(A1>0,B1>0),B1/A1,"-")``

What you are looking for?

#### UniMord

##### Active Member
Use: =IF(SIGN(A1)+SIGN(B1)=2,B1/A1,"-")

#### mwf3

##### New Member
Thanks

Thanks Barry, Crow and Unimord, they all worked great!!!

Replies
5
Views
121
Replies
22
Views
259
Replies
2
Views
231
Replies
1
Views
175
Replies
3
Views
87

1,195,849
Messages
6,011,957
Members
441,657
Latest member
Diupsy

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back