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: Adjusting Values with Formulas.

Adjusting Values with Formulas

Written by Allen Wyatt (last updated November 11, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003


There are times that you need to adjust the values stored in the cells of a worksheet. Most times, the tools provided by Paste Special will fit the bill just fine. For instance, you can use Paste Special to multiply or divide the values in a range of cells, as described in other issues of ExcelTips.

There is a drawback to using Paste Special, however—it changes the actual value, which you might not want to happen. Why? Because four months after making the adjustment to the values, you might not remember exactly what you did, or what the starting values were.

For this reason, you may find it more desirable to replace values with formulas that indicate what was done with your adjustment. For instance, you may have the value of 100 in cell B3, and you want to increase it by 10%. Using Paste Special you can easily change it to 110, but you may instead want to replace the value with the formula =100*1.1. With such a formula, there would be no question four months from now about the starting value or what you did to it.

The only way to adjust values with formulas is to use a macro, such as the following one:

Sub Adjust()
    Dim c As Range
    Dim sForm As String
    Dim sMod As String
    
    Set Target = ActiveSheet.Range(ActiveWindow.Selection.Address)
    sMod = InputBox("Formula to add?")
    If sMod > "" Then
        For Each c in Selection
            If c.HasFormula Then
                sForm = c.Formula
                sForm = "=(" & Mid(sForm, 2, 500) & ")"
                sForm = sForm & sMod
                c.Formula = sForm
            Else
                c.Formula = "=" & c.Value & sMod
            End If
        Next c
    End If
End Sub

To use this macro, select the cells you want to adjust, and then run it. You are asked for a formula to add to the cells. As an example, if you wanted to multiply the cells by 1.1, you would enter *1.1 (the asterisk multiplication symbol, followed by 1.1). The macro then steps through each selected cell and makes the adjustments. If the cell contains a formula, then the formula is adjusted as you specified. If the cell contains anything else, then it is turned into a formula that includes your adjustment.

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 (2592) 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: Adjusting Values with 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

Jumping to the Real Last Cell

Jumping to the last cell in a worksheet should be easy, but you may not always get the results that you expect. This tip ...

Discover More

Proper Comparisons for Dates in Merge Fields

How Word merges a data source with a document is controlled by merge fields. In those fields you may want to compare ...

Discover More

Opening Two Workbooks with the Same Name

If you have two workbooks that each have the same name, opening them at the same time in Excel could cause some problems. ...

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 (menu)

Converting Cells to Proper Case

When storing text in a worksheet, you may have a need to change the case of that text so that the initial letter in each ...

Discover More

Expiration Date for Excel Programs

If you use Excel to create a macro-based application, you may want to make sure that your programs cease working after a ...

Discover More

Conditionally Displaying a Message Box

You can, from within your macros, easily display a message box containing a message of your choice. If you want to ...

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 7 + 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.