If statement

abee4life

Active Member
Joined
Jan 27, 2005
Messages
319
Can someone help with an If statement please.

I have tried different variations of how to do what I want, but nothing seems to work.

I want in C1 a formula that tells me if A1 and B1 are the same and if so to return the number 1, if its not then 0. Now, I know the the basic formula would be =if(a1=b1,1,0) but it returns a 1 even if the two cells are empty.

What I want is for C1 to tell me 0 if the cells are blank, or do not have the same numbers as each other. Can someone help please.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,203
Can someone help with an If statement please.

I have tried different variations of how to do what I want, but nothing seems to work.

I want in C1 a formula that tells me if A1 and B1 are the same and if so to return the number 1, if its not then 0. Now, I know the the basic formula would be =if(a1=b1,1,0) but it returns a 1 even if the two cells are empty.

What I want is for C1 to tell me 0 if the cells are blank, or do not have the same numbers as each other. Can someone help please.

Assumes numeric entries...

=IF(COUNT(A1:B1)=2,IF(A1=B1,1,0),0)
 

Watch MrExcel Video

Forum statistics

Threads
1,130,118
Messages
5,640,211
Members
417,131
Latest member
Seanr19871

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top