Sum of 2 or 3 values in one cell, displayed in other cell

C

csoumy

This is my problem

I have only two cells in the excel say A1 and B1.

I want the sum of the values in the cell A1 to be displayed in B1.

For Eg: I enter 10 for the first time in the cell A1, I want 10 to be
displayed in B1.
The second time I enter 20 in the cell A1, I want 30(20+10) to
be displayed in B1.
The third time I enter 30 in the cell A1, I want 60(20+10+30)
to be displayed in B1.

Thus 30 should be displayed in the cell A1 and 60 should be displayed in the
cell B1.

i.e the latest value entered should be displayed in A1 and the cumulative
sum of the values entered should be displayed in B1.

Please help me out!
 
J

Jarek Kujawa

excel 2003
Tools->Options->Calculation tab->check Iteration, set it to 1

then in B1 insert formula:
=A1+B1
 
G

Gord Dibben

Jarek's method works.

But you will have no way of correcting any mistake in data entry except
entering a negative of the any number you entered.

There is no "paper trail" left behind for error-checking.

An Excel sheet has lots of cells. Why stick use just two of them?


Gord Dibben MS Excel MVP
 
J

Jarek Kujawa

thanks Gord
of course it would be better to find a more versatile method, but:

1. the OP wrote "I have only two cells in the excel say A1 and B1"
2. I couldn't think of any other solution

;-)))
 
G

Gord Dibben

Your solution was OK and answered OP's question.

I just tacked on the caveat about no paper trail.

One method of having an accumulator cell with a paper trail is to keep track
of entries in a Comment in the input cell.

Code from Jack Sons and Tim Williams........................

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cmt As Comment

If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error Resume Next
Set cmt = Target.Comment
On Error GoTo 0

If cmt Is Nothing Then
Set cmt = Target.AddComment(Text:="0")
End If

If cmt.Text <> "" Then
cmt.Text CStr(Target.Value & ", " & cmt.Text)
End If

End Sub


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top