Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. 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: Deleting Everything Except Formulas.

Deleting Everything Except Formulas

Written by Allen Wyatt (last updated April 25, 2020)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


7

At the beginning of each year Richard makes a copy of the previous year's Excel workbook. To get ready for the new year's data, he then needs to delete everything in the copy except for formulas. Richard wonders if there is a quick way to do this.

Actually, there is a very quick way to manually delete all the non-formula information in a worksheet. Follow these steps:

  1. Press F5. Excel displays the Go To dialog box.
  2. Click Special. Excel displays the Go To Special dialog box. (See Figure 1.)
  3. Figure 1. The Go To Special dialog box.

  4. Make sure the Constants radio button is selected. (This is extremely important—don't click any other option in the dialog box.)
  5. Click OK. All the cells containing constants (everything except formulas) are selected.
  6. Press the Del key.

If you have a lot of worksheets in a workbook and you want to delete all the constants from each of the worksheets, you might want to use a macro that automates the above steps for the entire workbook.

Sub DelAllConstants()
    Dim wks As Worksheet
    Dim rng As Range

    For Each wks In ThisWorkbook.Worksheets
        On Error Resume Next
        Set rng = wks.Cells.SpecialCells(xlCellTypeConstants, 23)
        On Error GoTo 0
        If Not rng Is Nothing Then
            rng.ClearContents
        End If
        Set rng = Nothing
    Next
    Set wks = Nothing
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11168) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Deleting Everything Except 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

Suppressing Headers or Footers

Don't want a header or footer to appear on just a portion of your document? It's easy to do when you understand that ...

Discover More

Adjusting the Angle of Axis Labels

When creating a chart, your axis labels may be wider than desired. One way to deal with them is to change the angle at ...

Discover More

Plotting Times of Day

Got a chart created from your worksheet? You can plot times of day in the chart if you apply the simple techniques in ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Separating Text by Color

Excel allows you to use multiple colors to format the text in a cell. If you want to later separate that text to ...

Discover More

Editing the Same Cell in Multiple Sheets

When creating a workbook, you may need to make changes on one worksheet and have those edits appear on the same cells in ...

Discover More

Ignoring Paragraph Marks when Pasting

Paste information in a worksheet, and you may end up with Excel placing it into lots of different cells. If you want it ...

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}] (all 7 characters, in the sequence shown) 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 1 + 1?

2020-05-11 07:08:42

John Mann

I notie thar right at the befining of this tip, it is apecified that this Rkichard does this every year. I have a similar situation with the accounts of a small non-ptofit group of whifh I sm the treasurer. My wrok book has quite a lot of sheets,with one worksheet for each period of the finanical year, then summary sheets for echa period and for the year.

I solved the problem of starting a new workbook each year the easy way - I saved a blank copy of the workbook as atemplate. Now each year I simply creat a new worknook using the template. A simialr method, thoufh more work and more error prone would be to save an empty copy of the workbook, then each year upen the copy, do a Save As to make the new uear's work nook. This runs the risk of foretting to do the Save As before starting to enter data, and the extra step of opening then doing the Save As. The template file is to me the most obvious solution to Richard's original question.


2020-04-28 11:18:43

Allen

Peter,

See the ExcelTips FAQ, here: https://excelribbon.tips.net/faq.html

The third Q&A answers your question.

-Allen


2020-04-28 11:08:09

Peter Clarke

Maybe I missed something when I subscribed to this blog a few months ago, but I understood that you included Excel for Mac in your discussions. I don't think I have yet to see any reference to Excel for Mac. As above, you give the "Press F5. Excel displays the Go To dialog box." On my MacBook Pro I push fn+F5 to get the Preference screen, not a Go to Special screen. (By the way, you only have Notes highlighted yet your text says, "Make sure the Constants radio button is selected. (This is extremely important—don't click any other option in the dialog box.)". Mixed messages here.
There ARE differences between the two platforms of Excel. It would be proper to not waste Mac users' time by identifying just what flavours of Excel that you are referring to.
Thanks. Be well.
Peter


2020-04-27 04:51:00

David Shepherd

Depending on the size and complexity of the workbook, another option might be to define a named range that includes all user-entry cells. Then use the named range to select the cells for deletion.


2020-04-26 14:29:31

Peter Atherton

Clifton

The image was supposes to show the selection, this taken with the Snipping Tool is hopefully, better.
(see Figure 1 below)

Figure 1. Selection for deletion


2020-04-26 14:11:19

Peter Atherton

Clifton
You could always follow the steps until OK ans see what is selected. The method deletes all Headers as well. I'd suggest the following Key Strokes: Ctrl + G, Alt + x, Alt + o, Alt + x, ENTER, (Del if happy)
The ALT + x de-selects Text

(see Figure 1 below)

Figure 1. 


2020-04-25 17:49:56

Clifton Schnarr

Hi Allen. Thanks for the helpful tip. Just one note. It would be helpful when you post, if you post an image of the settings you actually instruct us to set. In the posting your screen shot of the "Go To Special" dialogue box shows "Notes" being selected. If others like me have a tendency to go by the images in the post step by step, then we would not get the desired result. Also once we select "Constants" the options for "Formulas" (> Numbers, > Text, > Logicals, and > Errors) all become active and are all checked by default even though the "Formulas" radio button is not selected. You don't tell us what to do at this point. Do we need to uncheck these four options before proceeding, or is it not necessary? I will attempt to attach the dialogue box with only the constants radio button selected for your use. Many thanks for all your great tips! (see Figure 1 below)

Figure 1. 


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.