# Can I get a cell to add to itself?

##### New Member
Please forgive me if this question seems daft,
but I'm new to excel and just learning.

I need a cell's number to increase by 1
on the condition of another cell, something like;

=if(A10>500,+1) or if(A10>500,A1=A1+1)

Is there any way I could do such a thing in Excel?

thanks

### Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Welcome to the board

When do you want the increment to take place, each time A10 changes value? Other condition?

Kind regards
PGC

Yes I need it to change every time,
my example wasn't very clear.
I'd like it to go something like;
=if(A10="STRING" and B10>0, B1=B1+1)
And I'd like B1 to increase each time those conditions are true.

Thanks again.

Hi alkarkar, thanks for your help.
Your suggestion did work, but when A10 reverts back to it's original condition, so does A1.
I should point out that it's pocket excel I'm using,
but basic formulae should still work in the same way, I think.

You wrote:
when A10 reverts back to it's original condition, so does A1

What do you mean by this? What is ''the original condition'' (for both A10 and A1. An example?

I'd like it to go something like;
=if(A10="STRING" and B10>0, B1=B1+1)

I still don't understand very well what you want.

Anyway it may be this

Every time the values of A10 or B10 change, if both conditions A10="STRING" and B10>0 are true, then increment the value of the cell B1.

In this case you have to use the Change Event of the worksheet. Click on the tab of the worksheet, choose View Code and paste the code at the end of this post.

If I misunderstood what you want, please try to explain again and give a working example. like

- This is the initial condition of B1, A10 and B10
- A10 changes to ???, this happens
- B10 changes to ???, this happens
- B10 changes again, this time to ???, this happens
etc.

Hope this helps
PGC

Code:
``````Private Sub Worksheet_Change(ByVal Target As Range)

If Range("A10").Value = "STRING" And Range("B10").Value > 0 Then _
Range("B1").Value = Range("B1").Value + 1

End If
End Sub``````

Replies
7
Views
522
Replies
3
Views
406
Replies
8
Views
245
Replies
5
Views
369
Replies
4
Views
249

1,218,539
Messages
6,143,089
Members
450,461
Latest member
Bosavon

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