+ Reply to Thread
Results 1 to 4 of 4

Shortened IF statement to avoid repetitive calculation?

  1. #1
    Registered User
    Join Date
    07-12-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    2

    Cool Shortened IF statement to avoid repetitive calculation?

    I've always wondered... isn't there a shortened way to achieve the same goal as the following?
    Please Login or Register  to view this content.
    (Assume x is a long, complicated formula).

    If the value of the calculation is not 0, it really seems unnecessary to calculate it again. I realise I could do the initial calculation in a separate cell, then just use that value again, but I was just wondering if there's another formula or IF syntax that will accomplish the same thing in a single cell.

    Thanks in advance!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,308

    Re: Shortened IF statement to avoid repetitive calculation?

    Hi gksa,

    In the newer versions of Excel there is an IfError() function that may do what you are thinking.

    http://www.excelfunctions.net/Excel-Iferror.html
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Shortened IF statement to avoid repetitive calculation?

    You can format the result cell so that if the result is 0, it is hidden

    use formula

    =X

    and format as Custom: 0;-0;;@
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    07-12-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Shortened IF statement to avoid repetitive calculation?

    Hmmm... I know about IFERROR - I was hoping there was some version of it to use for something other than errors!

    As a rule, I try to use Conditional Formatting sparingly, because it seems to slow things down even more than VLOOKUP. But using a number format to hide the 0s could work very well in most cases, where the concern is merely with visual matters - thanks NBVC!

    Does anyone have any ideas though, for the cases where merely changing the display wouldn't cut it?

    Edit: I have spotted something along this line somewhere, but for the life of me I can't find it again. I seem to recall that the person had used syntax similiar to column() (which refers to the current column the cell is in without using an actual cell reference) in an IF statement, but that doesn't seem to work. Now I don't know whether they were just writing out the formula in shorthand, or not.
    Last edited by gksa; 07-12-2011 at 03:00 PM. Reason: Added info

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1