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

Saving Common Formulas

by Allen Wyatt
(last updated October 19, 2017)

7

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. Make sure the Formulas tab of the ribbon is selected.
  7. In the Defined Names area, click the Define Name option. Excel displays the New Name dialog box. (See Figure 1.)
  8. Figure 1. The New Name dialog box.

  9. In the Name box, enter the name you want assigned to this formula.
  10. 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 copied to the Clipboard in step 4.
  11. 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.)
  12. 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 8. 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 macro workbook. 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 macro workbook, follow these steps:

  1. Start Excel with a new workbook.
  2. Display the View tab of the ribbon.
  3. Click the down-arrow under the Macros tool and then click Record Macro. Excel displays the Record Macro dialog box. (See Figure 2.)
  4. Figure 2. The Record Macro dialog box.

  5. Using the Store Macro In drop-down list, choose Personal Macro Workbook.
  6. Click OK. The Macro Recorder is now running.
  7. Select any cell in the worksheet. (It doesn't matter which one you choose.)
  8. Click Stop Recording on the ribbon's Developer tab.

The macro you recorded is now stored in your newly created Personal macro workbook. 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.XLSB. 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 where you need it.

Finally, you could also place your common formulas into AutoCorrect entries. Follow these steps:

  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. Display the Excel Options dialog box. (In Excel 2007 click the Office button and then click Excel Options. In Excel 2010 and Excel 2013 display the File tab of the ribbon and then click Options.)
  7. At the left side of the screen click Proofing.
  8. Click the AutoCorrect Options button. Excel displays the AutoCorrect dialog box. (See Figure 3.)
  9. Figure 3. The AutoCorrect dialog box.

  10. In the Replace box enter a name you want associated with your formula.
  11. Position the insertion point in the With box.
  12. Press Ctrl+V to paste the formula you copied in step 4.
  13. Click Add. The formula is now safely stored in an AutoCorrect entry.
  14. Close all the dialog boxes on the screen.

You can now use your formula as you would any other AutoCorrect entry. Just type whatever you used in step 9 and then press Enter. The name is replaced with the full formula.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6135) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel 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

Adding a Missing Closing Bracket

When working with large amounts of data, it is a good idea to make sure that the data all consistently follows a pattern. ...

Discover More

ScreenTips without Hyperlinks

ScreenTips can be a helpful feature in some documents, but adding them also means you need to add a hyperlink. Here's a way ...

Discover More

Changing Shortcut Properties

Want to change how a shortcut behaves when you double-click it? Just display the Properties dialog box for the shortcut and ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Changing the Reference in a Named Range

Define a named range today and you may want to change the definition at some future point. It's rather easy to do, as ...

Discover More

Relative References within Named Ranges

Excel is usually more flexible in what you can reference in formulas than is immediately apparent. This tip examines some ...

Discover More

Counting Wins and Losses

Need to count the number of W (win) or L (loss) characters in a range of cells? You can develop a number of formulaic ...

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 3 + 8?

2017-10-25 06:00:10

Ruthie

Wow! I thought that the article was a great tip as I learned something new. But Col Delane's comment on using the PMW is even better for my purposes as I can save whole worksheets with sample data as well as have a worksheet with just a list of my more commonly used custom formulas. I manipulate text in many different ways for various data sets and sometimes can't remember quite how I handled a particular set if it has been a while. I'm going to start using Col's tip today!


2017-10-19 09:06:30

Col Delane

There is no need to bother with these unnecessarily cumbersome methods when there is a much easier and more useful solution which is a simpler variation of the third option described in this tip - using your Personal macro workbook! However, rather than save your sample formulas within the VB editor as inert text entries, why not use the spreadsheet interface already provided - after all the PMW is just an standard Excel workbook with a couple of special attributes.

This what you do:
1. Create a PMW as described above
2. From the spreadsheet interface Insert a new sheet and rename it "Samples"
3. Into this worksheet, copy/paste or directly enter your sample formula, with appropriate data and/or other spreadsheet elements that assist with demonstrating how the formula works.
4. Hide the workbook
5. Close Excel and click Save when requested so that your updated PMW is saved in "hidden" mode

When you need to use a sample, just unhide the workbook, copy the formula required & paste it where required, then rehide the PMW. (Even better, create a macro within the PMW that unhides it if hidden or hides it if visible, and link a button on your QAT to this macro.)

Note that you're not limited to storing just formula samples - you can use this workbook as a comprehensive knowledge store/toolbox holding whatever Excel samples (even complete sheets) you require. Examples include samples of Conditional Formatting, Data Validation, Defined Names.


2015-09-23 22:27:09

vamshi krishna jannapureddy

I need a excel templates for my college to add details and edit detail (like fee & marks )


2015-02-20 09:55:34

sarma

The autocorrect options did not work.


2015-02-20 09:54:09

sarma

Sorry to say, the method didn't work.


2015-02-20 09:48:13

sarma

You've made entering a formula with autocorrect option amazingly simple. I had a cumbersome method for it all these years.
Thanks & thanks.


2014-11-07 14:59:49

Linda Bohy

If I use the define name option shouldn't the formula be available to use in another Excel workflow or it only for that file?


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.