Excel: Adding an Inputted Number to a Selected Cell

Last reviewed: November 29, 1994
Article ID: Q23608
The information in this article applies to:
  • Microsoft Excel for the Macintosh, versions 1.x, 2.x, 3.0, 4.0

SUMMARY

In Microsoft Excel, to add a number to an existing number and put the result into the same cell, you must use a macro.

The following macro selects the cell in question (in this example: B5), asks for the number to be added to the existing value, and places the result back into the cell (B5):

   A1:  AddToCell
   A2:  =SELECT(!$B$5)
   A3:  =FORMULA(ACTIVE.CELL()+INPUT("Enter a number",1))
   A4:  =RETURN()

MORE INFORMATION

SELECT selects cell B5 on the active worksheet.

FORMULA places the value or formula into the active cell on the active worksheet.

ACTIVE.CELL returns the value in the active cell (in this case, B5).

INPUT calls up an input box for you to type in the number to be added to the original value.

REFERENCES

For more information about these functions, see pages 193, 224, and 274 in the "Microsoft Excel Functions and Macros" version 2.2 manual. If you are using Excel version 1.50, see pages 208, 230, and 261 in the "Microsoft Excel Arrays, Functions, and Macros" manual.


KBCategory: kbusage
KBSubcategory:

Additional words: 1.x 2.x 3.0 3.00 4.0 4.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 29, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.