# Changing a value based on equality between two other values [closed]

Here it's the situation, I have:

``````A1=1
B1=2
B2=2
``````

And I want to do an If function so that `If B1 = B2` `A1` will be `1 + 1`, so `A1` is now `2`. I tried:

``````=If(B1=B2,A1=A1+1,A1)
``````

but it not working.

-
Please elaborate beyond "it not working". Was there an error? Did you get a value? What was it? –  Krampus Sep 30 '12 at 1:15

## closed as not a real question by Eight Days of Malaise, Alex, ChrisF♦Oct 4 '12 at 21:35

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

You can't do that. A cell either needs to be a value or a formula. I would expect a formula in a cell that references the same cell to throw an error for a circular reference.

I don't know what it is exactly that you're trying to accomplish, but you could do something like this:

Simply keep your original value in one cell and the formula in another.

``````A1=1
B1=2
B2=2
``````

Then put the formula for your result in a different cell.

``````A2=If(B1=B2,A1+1,A1)
``````
-
OK thanks guys. –  Hunter95 Sep 30 '12 at 4:03