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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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)
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,961
Latest member
nzskater

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
Back
Top