Can I get a cell to add to itself?

padcrusher

New Member
Joined
Sep 25, 2006
Messages
3
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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi padcrusher
Welcome to the board

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

Kind regards
PGC
 

padcrusher

New Member
Joined
Sep 25, 2006
Messages
3
Hi PGC, thanks for replying.
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.
 

padcrusher

New Member
Joined
Sep 25, 2006
Messages
3

ADVERTISEMENT

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.
 

alkarkar

Board Regular
Joined
Sep 18, 2005
Messages
125
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?
 

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi padcrusher

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 Target.Address = "$A$10" Or Target.Address = "$B$10" Then

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

End If
End Sub
 

Forum statistics

Threads
1,141,931
Messages
5,709,406
Members
421,635
Latest member
mehdi hannechi

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