+ Reply to Thread
Results 1 to 4 of 4

Excel function is returning undesired answer for blank cells

  1. #1
    Registered User
    Join Date
    07-10-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    2

    Excel function is returning undesired answer for blank cells

    Hi! I'm trying to use the following function to test the contents of a cell and generate a code based on the value of less than, equal to or greater than zero. If there is no data in the cell then I want a a blank or error. It works ok when there is number data in the target cell, but when there's a blank I get a code and I don't understand why. This might be simple but I' missing it. I searched the forum and didn't find anything that I could easily relate to.

    =IF(J2>0,"Incr",IF(J2=0,"NoChg",IF(J2<0,"Decr","Error")))

    Thanks in advance D
    Last edited by dcwandj; 10-28-2012 at 09:01 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Excel funtion is returning undesired answer for blank cells

    Try this:

    =if(j2="","",IF(J2>0,"Incr",IF(J2=0,"NoChg",IF(J2<0,"Decr","Error"))))

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    07-10-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Excel funtion is returning undesired answer for blank cells

    Pete: Hey that did the trick! Thanks. If you have time, can you explain?

    Derek

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Excel funtion is returning undesired answer for blank cells

    Well, basically it checks first to see if J2 is a blank ("") and if so it returns a blank, but if not then it carries out your previous formula.

    Hope this helps.

    Pete

+ 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