+ Reply to Thread
Results 1 to 7 of 7

adding result of a function to a cell already containing a value

  1. #1
    Registered User
    Join Date
    09-05-2011
    Location
    Tehran, Iran
    MS-Off Ver
    Excel 2007
    Posts
    14

    adding result of a function to a cell already containing a value

    is there any way of coding to do this?

    for example we have :

    A1.value = 5
    A1.Formula = 2*3 ' ...... entering a formula into the same cell A1

    A1.Value = 11 ? '...... at the end it becomes 11

    thanks a lot..

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: adding result of a function to a cell already containing a value

    Is the value (5) in A1 being entered manually, or does it come from somewhere else, like another cell or sheet?
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    09-05-2011
    Location
    Tehran, Iran
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: adding result of a function to a cell already containing a value

    Manually .. Or.. it is already calculated by a simple formula (say =0.05*100)
    thanks..

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: adding result of a function to a cell already containing a value

    If its entered manually into the cell, in this case, A1, you cannot have a formula in that cell, it will give a "Circular Reference" error as you cannot (at least I don't think you can) have a formula in a cell that references itself. If it is entered with the formula that you show in your last post, change your formula to
    Please Login or Register  to view this content.

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: adding result of a function to a cell already containing a value

    You posted this in the VBA section so I'm assuming you may be looking for something like this.
    Right click on the tab for the sheet you want the code to run on and click view code. Paste the code below into the code window.
    The code uses cell A1 as an example. If the for example the value in cell A1 starts at zero, if I type 10 into cell A1 the value will change to 10. If I now type = 10 * 2, then the value changes to 30, but there is no formula left in the cell. So the code stores the previous value and adds the results of what you type into cell A1 to that previous value.
    If you want to get the value in cell A1 back to zero then type negative whatever the amount in the cell is.
    For instance the cell now say 30, so I type -30 into the cell hit enter and I have restored the cell to zero.

    EDIT:

    I added some more code at the bottom. Follow the instructions for adding that code.

    Please Login or Register  to view this content.
    After you enter the code above you should see the project explorer window. You will see ThisWorkbook in that window. Right click on ThisWorkbook, choose view code and paste the code below into that window.
    If you don't see ThisWorkbook then go to the menus at the top choose View and Project Explorer or as a shortcut you could just press Control + r
    In the code where you see "Sheet1" type the name of your sheet with the quotes. So if your sheet is named Data, then change "Sheet1" to "Data" in the code.

    Save the workbook as a .xlsm macro enabled workbook.

    Please Login or Register  to view this content.
    Last edited by skywriter; 05-31-2015 at 02:12 PM.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,522

    Re: adding result of a function to a cell already containing a value

    This should do

    To a sheet code module
    Please Login or Register  to view this content.

  7. #7
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: adding result of a function to a cell already containing a value

    My bad, I didn't pay attention to the fact (obviously)that this post was in the VBA/Macro section.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Freeze cell with result; don't move cell when adding new lines
    By rolive in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 06-23-2014, 04:38 PM
  2. Adding multiple cells based on the result of a data validation cell
    By ronrona96 in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 01-20-2013, 12:19 AM
  3. Replies: 3
    Last Post: 02-14-2011, 05:26 AM
  4. Adding a Name Cell to a MIN Result
    By bobbby1949 in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 08-10-2010, 12:33 AM
  5. Adding colour to result in a cell?
    By Pheasant Plucker® in forum Excel General
    Replies: 7
    Last Post: 01-24-2006, 11:16 AM

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