+ Reply to Thread
Results 1 to 10 of 10

Adding numbers in the same cell

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    socal
    MS-Off Ver
    Excel 2010
    Posts
    48

    Adding numbers in the same cell

    how can I take a number from one cell and add it to a number from another cell and keep the answer in the same cell

    THANKS RICHARD!
    Last edited by JimLau; 09-28-2012 at 02:00 AM.

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Adding numbers in the same cell

    You are describing an accumulator. Say you enter 4 in A1 and A2 becomes 4. If you now enter 7 in A1, A2 becomes 11. If you then enter 9 in A1, A2 becomes 20.

    You can set this up with a macro.
    Is this what you want?
    Gary's Student

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Adding numbers in the same cell

    Hi,

    You would need to use a macro. Something like

    Range("A2") = Range("A2")+Range("A1")
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    09-26-2012
    Location
    socal
    MS-Off Ver
    Excel 2010
    Posts
    48

    Re: Adding numbers in the same cell

    Yes this is exactly what I want with a twist. Not only do I need to update the number but I have to find the Part in goes to on the same row. there are 32 parts in that column. So I have to find it first the update it.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Adding numbers in the same cell

    Hi,

    I find it difficult to visualise what you describe. Can you give some specific examples please?

  6. #6
    Registered User
    Join Date
    09-26-2012
    Location
    socal
    MS-Off Ver
    Excel 2010
    Posts
    48

    Re: Adding numbers in the same cell

    I have an Inventory file and of to the side of the table I have two cells one for the part# and one for the amount the user will adjust their inventory by. They can't go to the Qt. cell because it is update by another function. So I need to find the Part # in one column and then update the Qt. in another column on the same row. Am I sounding nuts!

  7. #7
    Registered User
    Join Date
    09-26-2012
    Location
    socal
    MS-Off Ver
    Excel 2010
    Posts
    48

    Re: Adding numbers in the same cell

    Sorry Richard:
    One other thing, if this is done in a macro. Can the macro run when they hit the enter key after they put the number in the cell.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Adding numbers in the same cell

    Hi,

    Yes, you'd use a Sheet_Change macro to update the relevant line that contains the Quantity.
    I suggest that you add a third helper cell which uses an =MATCH() function to identify which row of your table contains the Part # you enter (either directly or via a drop down containing all part numbers) and then use that helper cell in the macro.

    Untested since I don't have direct access to Excel at the moment - but assuming the part numbers are all in column A, with quantities in Column B, the part number in say D1 and the Quantity to adjust in E1, with a helper cell in F1 which contains the function
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Name the helper cell say "UpdateRow"

    Now the macro would be

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-26-2012
    Location
    socal
    MS-Off Ver
    Excel 2010
    Posts
    48

    Re: Adding numbers in the same cell

    Again Sorry Richard:
    This is a little confusing but I getting it some what, let me give you more exact details. I put the =match in cell W14 and it returns the proper row #. the Part # that I am entering to look for is in W6 and the Qt. # I am entering to add to the Qt. Already in place is in U6. The list of part #'s are in C4:C35 and the number I am trying to add to is in F4:F35. I didn't quite understand what you meant by naming the help cell "UpdateRow"

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Adding numbers in the same cell

    Hi,

    All I meant was that you should apply a name to the W14 cell and then use the name in the macro rather than the absolute W14 cell reference. As a general rule you should use named cells/ranges in functions and macro code for all sorts of good reasons, not least that formulae are easier to read. You could instead use

    Please Login or Register  to view this content.
    but you can probably see that if you were to change or move the W14 helper cell then you'd also need to edit the macro, whereas if you always name cells then you never need to worry about editing the macro. For the same reason it would also be a good idea to name the W6 quantity cell and use that name rather than the W6 reference.
    Last edited by Richard Buttrey; 09-28-2012 at 06:54 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1