LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 138
Default How do I add/count numbers in the same cell in excel worksheet?

For a start, put following code into a module. When you run the
AddValueOnEnter macro, whatever value you enter will be added to the
existing value (your existing '127' will become '=127+50', so that you can
still trace your inputs). Run ResetEnter when you want to reset the ENTER
key to normal behaviour.

Cheers,
Joerg Mochikun


Public PresentValue As String

Sub AddValueOnEnter()
Application.OnKey "{ENTER}", "AddValue"
End Sub

Sub ResetEnter()
Application.OnKey "{ENTER}", ""
End Sub

Sub Addvalue()
On Error Resume Next
If Left(PresentValue, 1) < "=" Then PresentValue = "=" & PresentValue
ActiveCell.Formula = PresentValue & "+" & ActiveCell.Formula
PresentValue = ActiveCell.Formula
End Sub








"Scott" wrote in message
oups.com...
Probably the wisest way to use one cell to do this would be to put the
following in the cell:

=127

When you get a $50 receipt, change it to:

=127+50

When you get another receipt, say 34.95:

=127+50+34.95

The reason to do it this way is so that if you happen to make a mistake
when entering the value, you don't lose your previous data.

Scott

Brecken wrote:
How do I create a function or formula in acell to perform this

operation?
(i.e if I have the number 127 in a cell and want to to enter 50 into the

same
cell so that I get a sum of 177 in the same cell, how do I do this,

rather
than adding the 2 numbers in my head, and manually entering 177?) I am

doing
this for purposes of a budget and entering receipts. If the amount I've
spent on groceries is $127 up to the present time, and I want to add an
additional grocery receipt of $50, I want to be able to have the cell

add the
new entry, rather than adding the 50 in my head and enter $177.

Thanks!



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel won't stop rounding numbers. Please help [email protected] Excel Discussion (Misc queries) 9 December 18th 06 07:38 PM
How do I prevent entering duplicate numbers in an excel worksheet Bran5956 Excel Worksheet Functions 1 October 23rd 06 06:03 PM
How do I get ONLY new info from 1 Worksheet to another automatical Elaine Excel Worksheet Functions 6 July 13th 06 05:45 PM
Adding a row to worksheet does not update cell references in another. blausen Excel Worksheet Functions 5 February 25th 06 09:14 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 06:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"