Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Saving Common Formulas.

Saving Common Formulas

by Allen Wyatt
(last updated July 27, 2013)

1

Sometimes, creating just the formula you want can be a victory all in itself. Once created, formulas become valuable, and you may need to use them over and over again in different worksheets you use. Wouldn't it be great to have a way to paste commonly used formulas in a workbook, the same way you can paste clip art or other common objects?

Unfortunately, such a capability is not resident within Excel. There are a couple of things you can do to make your formulas more accessible, however. One thing you can do is keep a text document (a Notepad document) on your desktop, and store your commonly used formulas in it. With Excel open, you can open the text document, copy the desired formula to the Clipboard, and quickly paste it in the desired cell of the workbook.

Another possible solution is to assign names to your formulas.

  1. Enter your formula as you normally would.
  2. Select the cell containing the formula and press F2. This places Excel in edit mode.
  3. Hold down the Shift key as you use the cursor control keys to select the entire formula, including the equal sign at its very beginning.
  4. Press Ctrl+C. The formula is now on the Clipboard.
  5. Press Esc. You should now be out of edit mode, and the cell with the formula is still selected.
  6. Choose Name from the Insert menu, then choose Define. Excel displays the Define Name dialog box. (See Figure 1.)
  7. Figure 1. The Define Name dialog box.

  8. In the Names in Workbook box, enter the name you want assigned to this formula.
  9. Select whatever is in the Refers To box, at the bottom of the dialog box, and press Ctrl+V. The cell reference is replaced with the formula that was on the Clipboard.
  10. Make sure there are no dollar signs in the formula. If there are, select them and delete them. (This method of using formulas does not work well with absolute references.)
  11. Click OK.

Now, whenever you want to use the formula, you simply enter an equal sign and the name you gave to the formula in step 7. Even though the name shows in the cell, the formula assigned to the name is actually used in doing the calculation. Since the formula used relative references (you got rid of the dollar signs), it is always relative to where you use the name in the worksheet.

Another approach works great if you are comfortable with macros and with the VB Editor. This approach involves making your common formulas part of your Personal.xls file. This workbook is opened whenever you start Excel, and is designed primarily for macros and customizations that you want available whenever you use Excel. But, there is no reason it cannot be used for common formulas, as well.

Assuming you haven't yet created a Personal.xls file, follow these steps:

  1. Start Excel with a new workbook.
  2. Choose Macro from the Tools menu, then choose Record New Macro. Excel displays the Record Macro dialog box. (See Figure 2.)
  3. Figure 2. The Record Macro dialog box.

  4. Using the Store Macro In drop-down list, choose Personal Macro Workbook.
  5. Click OK. The Macro Recorder is now running, and the Stop Recording toolbar should be visible.
  6. Select any cell in the worksheet. (It doesn't matter which one you choose.)
  7. Click Stop Recording on the Stop Recording toolbar.

The macro you recorded is now stored in your newly created Personal.xls worksheet. To see the code that you created, open the VB Editor (Alt+F11). In the upper-left corner of the editor is the Project Explorer; it lists all the various pieces and parts accessible through the editor. One of the items in the Project Explorer should be PERSONAL.XLS. If you expand this object (click the small plus sign to the left of the project name), you should see a Modules folder. Expand the Modules folder, and it contains Module1. If you double-click on this module you see the macro you just recorded; it looks something like this:

Sub Macro1()

' Macro1 Macro
'

'
    Range("A4").Select
End Sub

You can now select this code and delete it, since you don't need it any more. You can then place other macros or user-defined function in the module, so they will be available.

What about formulas? Copy them to the Clipboard and paste them in the module, outside of any procedures defined therein. All you need to do is make sure you preface the formula with an apostrophe, so that the VB Editor thinks you are entering a comment. When you need the formulas at a later time, just go to the VB Editor, open the module, copy the formula, and paste it into the workbook you need.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2957) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Saving Common Formulas.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Controlling Footnote Placement

Footnotes are normally placed at the bottom of the page on which the footnote is referenced. However, Word provides some ...

Discover More

Adding an Equal Sign Tool

Excel used to provide, prior to Excel 2002, an equal-sign tool near the Formula bar. If you miss this tool, you may want to ...

Discover More

Changing Sort Order

When sorting information, Word follows some pretty strict rules. If you want to modify how those rules are applied, you may ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (menu)

Finding the Sum of a Sequential Integer Range

In mathematics, the sum of a range of sequential integers, starting with 1, is known as a triangular number or Gaussian ...

Discover More

Determining "Highest Since" or "Lowest Since"

When compiling statistics on a collection of data points, you may want to know whether a particular value is the "highest ...

Discover More

Finding Differences Between Lists

A common task faced by Excel users is to determine whether items in one list are also found in a different list. There are a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 + 0?

2017-06-08 12:01:15

Ben

dear Sir,

First of all, thank you very much for your very interesting article above.

I used it because I want to calculate the amount I have to invoice to my clients : different formulas are used depending on the service rendered. in this formula, there is a variable that is the number of hours.

nevertheless, the problem that I encounter is that when I want to reuse the formula, it always refer to the sheet where I first created this formula (despite the fact that the formula doesn't contain any absolute reference). Each sheet corresponds to a the case that I handle for the client.

for example, here is what I have in the "refers to" box wherein a first created the formula for case 1 “=10+('case1'!L8*20) “

then, when I have another case than case 1 and I want to reuse a customised formula, I have to correct the reference.

I tried to find a solution knowing that the cell containing the number of hours and the cellular formula or adjacent. But I didn't find despite a thorough research on Internet for mentioning in the formula that the cell should be the adjacent one.

could you eventually suggest a solution ?

I thank you in advance for your answer.

Best regards.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.