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: Dealing with Long Formulas.

Dealing with Long Formulas

Written by Allen Wyatt (last updated December 29, 2018)
This tip applies to Excel 97, 2000, 2002, and 2003


5

Anyone who has been using Excel for any length of time knows that some formulas can get quite long. Excel handles them—as long as they are constructed correctly—but they can be a bear for humans to understand. Even after you develop your own formulas, you may have trouble understanding them weeks or months later.

One way to make formulas a bit easier to understand is to use Alt+Enter in the middle of the formula to "format" how it appears on the screen. Consider, for instance, the following long formula:

=+IF($A2=0,0,IF($B2<4264,0,IF(AND($B2>=4264,$B2<=4895),
(-22.31*$C2/365),IF(AND($B2>=4895,$B2<=32760),($B2*0.093-
476.89)*$C2/365,IF($B2>32760,($B2*0.128-1623.49)*$C2/365)))))

This formula could also be written in the following manner, with Alt+Enter being pressed at the end of each line in the formula:

=+IF($A1=0,0,
IF($B1<4264,0,
IF(AND($B1>=4264,$B1<=4895),(-22.31*$C1/365),
IF(AND($B1>=4895,$B1<=32760),($B1*0.093-476.89)*$C1/365,
IF($B1>32760,($B1*0.128-1623.49)*$C1/365)))))

Now, the broken-up formula appears on five lines, even though it all appears in a single cell. The broken-up formula works just as if it were all on one line.

In addition, if you copy the complete broken-up formula from the Formula bar and paste it into a worksheet, each line in the formula is pasted into a different cell, making it easy to test each part. This is much quicker than copying and pasting parts of the original formula.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3043) 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: Dealing with Long 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

Getting Word to Remember the Default Date and Time Format

One way to insert the current date into your document is to use the Date and Time dialog box. The Default button in the ...

Discover More

Capitalizing Just a Surname

Changing the capitalization of text is, believe it or not, a common task in Excel. Common or not, it can be frustrating ...

Discover More

Setting an Upper Threshold for a Cell

Do you want to limit what can be entered into a particular cell in your worksheet? Here are three separate ways you can ...

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

Automatically Moving from Cell to Cell when Entering Data

As you enter data in a worksheet, you may want to have Excel automatically move from cell to cell based on the length of ...

Discover More

Forcing Input to Uppercase

If you type information into a workbook, you may want to make sure that what you type is always stored in uppercase. ...

Discover More

Displaying a Hidden First Row

If you hide the first rows of a worksheet, you may have a hard time getting those rows visible again. Here's a simple way ...

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

2021-08-04 23:01:14

Gareth Hayter

FormulaSpy (from FormulaDesk) is another Excel add-in that also helps with these scenarios https://www.formuladesk.com/formulaspy/


2021-03-04 19:49:04

Simon B

This is another online tool for formatting Excel formulas:

https://www.formulaboost.com/parse

What's good about this one is that the formatted formulas are still valid and can be pasted back into Excel.


2020-06-25 12:09:47

Christie Bellah

This is perfect, thank you! For one column on the report I'm doing today I need so many IFs that I'd started to wonder if I should create some extra columns to break it up some - just to make the formulas more readable. I like your solution a lot better.


2020-05-13 06:15:28

Mat

Or maybe something like this:
excelformulabeautifier.com


2020-02-06 09:24:35

André Fernandes

Great!


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.