# If Formula

#### omairhe

##### Well-known Member
Peace,

what formula that checks cell F2 and cell G2 for 0/blank values.

If both the above cells are 0/blank then give output 0 otherwise give output 1.

Thanks.

### Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
=(and(isblank(f2),isblank(g2)))

What type of value would be in the cells if they are not 0/blank ? Text or Number?

This might be better:

=AND((OR(ISBLANK(F2),F2=0)),OR(ISBLANK(G2),G2=0))

Numeric.

What type of value would be in the cells if they are not 0/blank ? Text or Number?

try
=--(SUM(F2:G2)<>0)

YES thanks..

Important to note that if the cells have negative numbers, and the sum of those numbers = 0, then you get a false when it should be true.
Example
F2=2
G2=-2
sum(F2:G2)=0, formula results in 0

negative may not occur in such an instance. Is number and all positive. thanks again..

Dear jommo1,

I needed to say the formula y've posted is running fine however it'd be great if it could output values in " 0 , 1 and 2 "

example "0"

F2 = 0 or blank
G2 = 0 or blank

hence H2 = 0

example "1"

F2 = 50 or any other value except for 0
G2 = 0 or any other value except for 50

hence H2 = 1

example "2"

F2 = 50 or same value as G2 except for 0
G2 = 50 or same value as F2 except for 0

hence H2 = 2

please let me know if further clarification is required.

Replies
4
Views
604
Replies
1
Views
325
Replies
2
Views
94
Replies
4
Views
183
Replies
3
Views
99

1,218,746
Messages
6,144,258
Members
450,533
Latest member
xoxo1998

### 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