Infinite opportunities?  Endless problems?  Limited resources?  Talk to us!
Operations
Consulting
Software
Consulting
Publishing and
Training
Applied
Solutions
Excel add-ins
and tutorials
Charts Excel and VBA
Case Studies
VBA
tutorials
PowerPoint
Add-Ins
Miscellenia
You are on the Home/Excel/Tutorials/Format formulas page

Formatting a formula 

A not so well documented feature of Excel is that it is possible to format a formula to improve readability.  For example, it is possible to have a formula look like:

=INDEX(YVals,MatchIdx)
+(INDEX(YVals,MatchIdx+1)-INDEX(YVals,MatchIdx))
    /(INDEX(XVals,MatchIdx+1)-INDEX(XVals,MatchIdx))
    *(targetVal-INDEX(XVals,MatchIdx))

with the corresponding screenshots
"In-cell" editing:

Editing in the formula bar

About this site

What's new

Google
Web
This Site
 

Of course, the typical and default formula would look like:

=INDEX(YVals,MatchIdx)+(INDEX(YVals,MatchIdx+1)-INDEX(YVals,MatchIdx))/(INDEX(XVals,MatchIdx+1)-INDEX(XVals,MatchIdx))*(targetVal-INDEX(XVals,MatchIdx))

or the corresponding screenshot:

How to format a formula

It's actually quite easy.  Use the key combination ALT+ENTER to create a 'new line' in a formula.  To add an indent simply use the space bar!

A caveat

Under some circumstances that I cannot replicate, Excel will reformat the formula back to the default style.  So, please keep that in mind before you invest a significant amount of effort formatting formulas.

 

 
 

For custom technology solutions, operations consulting, or training contact web-underscore-contact@tushar-hyphen-mehta-dot-cee-oh-em.
By accessing any page or link on this web site other than this page, you agree to the terms and conditions.

Ads from amazon.com

[Optional] Survey (current rating of site: 3.7 out of 4)  If you will take a moment to provide your comments, it will help improve the site both for you, and for other visitors.

On a scale of 4 (just what I need)
to zero (totally useless)

How do you rate the information

on this page?

  on this site?

[Optional]

Your name
Your email address
Other comments
 
Monitor page
for changes
    
   it's private  

by ChangeDetection
A comment selected at random:

 

 

Copyright © 2000-2008 Tushar Mehta.
Send comments and suggestions about the web site to webmaster@tushar-hyphen-mehta-dot-cee-oh-em
Last edited April 13, 2008