View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
David McRitchie David McRitchie is offline
external usenet poster
 
Posts: 903
Default having a running total

The example formula were incorrect
though the macro does what I understood
though I don't think it is want you want because
now you indicate a variable number of postcards
as being the items sold from an envelope.

B2: 2.00
C2:
D2: =B2+C2

B3: =OFFSET(D3,-1,0) instead of =D2
C3:
D3: =OFFSET(D3,-1,0)+C3 instead of =D2+C3

as you enter values in the C column
starting in C3 the other formulas on each
side of the entered value would be filled in
if you install the event macro.

I can't tell from one row what you want, looks
to me like you are only entering cash amount pounds in
the middle and totaling the cash received.

If you are trying to always enter on one row
to cumulatively add to what is already on the
same row that would not be a good thing to
do (no audit trail) and I don't do them.

As long as the intent is enter each sale on the
row below the previous sale there would be no
problem in modifying what I sent you, so email me
an example with several sales in it so I can see
what you want. (simply reply to me, rather than to group).
---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Kathy Flynn" wrote in message ...
Hi David,
I don't think I explained myself very clearly or maybe I just can't figure
out your answer. I tried the OFFSET thing but it didn't seem to work. What I
have is a series of envelopes each with about 100 postcards I'm selling. When
I sell a postcard I want to update the data for that envelope that I have
sold a card and how much for so that I know how many cards I have sold from
that envelope for a total of how much. I was using one row for each envelope
with the columns for 'no. of cards', 'cards sold', 'amount added' and
'running total'. Perhaps you can suggest a way??

"David McRitchie" wrote:

Hi Kathy,
I don't know why you would show a Balance
and a Running total. But as I understand your
question.

B2: 2.00
C2: <entry
D2: =B2+C2

B3: =OFFSET(D2,-1,-)
C3: <entry
D3: =OFFSET(D2,-1,0)+C3

Use the fill handle to copy B3:D3 downward (if C3 is empty)
http://www.mvps.org/dmcritchie/excel/fillhand.htm
or use an automatic entry with an event macro as below

Right click on the sheet tab, View Code

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'to install -- right-click on the sheettab of the corresponding
' sheet and choose 'view code'. Paste the following procedure
' in the module.

If Target.Column < 3 Then Exit Sub
If Target.row < 3 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Dim R As Long
R = Target.row
Target.Offset(0, -1).Formula = _
"=OFFSET(" & Target.Offset(0, 1).Address(0, 0) _
& ",-1,0)"
Target.Offset(0, 1).Formula = _
"=OFFSET(" & Target.Offset(0, 1).Address(0, 0) _
& ",-1,0) + " & Target.Address(0, 0)
ErrHandler:
Application.EnableEvents = True
End Sub

Read about Event macros at
http://www.mvps.org/dmcritchie/excel/event.htm
Read about inserting rows and OFFSET at
http://www.mvps.org/dmcritchie/excel/insrtrow.htm

---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Kathy Flynn" <Kathy wrote in message

...
I want to have a columns with totals which I can update when I enter info.
Example: Envelope Balance Added value Running Total
1 £2.00 3.00 5.00
I want to be able to keep inputting different values into 'Added Value' as I
sell things from that envelope. Anyone know how I can do this?
Thanks.
Kathy