+ Reply to Thread
Results 1 to 5 of 5

if function returning 0 when it should not

  1. #1
    Registered User
    Join Date
    11-14-2012
    Location
    Texas, United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Unhappy if function returning 0 when it should not

    My formula is:

    =IF(SUM($E$7:$G$7)=0,HLOOKUP(LARGE($B7:$D7,1),$B7:$D7,1,FALSE),"sweet")

    I can't figure out why the above formula keeps returning a zero. Shouldn't it return the HLOOKUP value? I used the "Evaluate Formula" Excel feature, and everything looks good, up to the point of getting a "0," i.e., =IF(TRUE,94,"sweet"). I even pulled the HLOOKUP function out of the formula to test it, and it worked properly. I mean, shouldn't it return the value "94," instead of "0"?

    What am I doing wrong?

    Thanks in advance,
    Scientia
    Last edited by scientia; 12-12-2012 at 12:21 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: if function returning 0 when it should not

    Either The sum value of the range may be zero or the range values are text data.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    11-14-2012
    Location
    Texas, United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: if function returning 0 when it should not

    Quote Originally Posted by :) Sixthsense :) View Post
    Either The sum value of the range may be zero or the range values are text data.
    Thanks for the quick response! You are correct that the sum value of the range is zero, but why does that matter? I thought that would yield the "True" value of the IF function... ?
    Last edited by scientia; 12-12-2012 at 12:25 AM.

  4. #4
    Registered User
    Join Date
    11-14-2012
    Location
    Texas, United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: if function returning 0 when it should not

    I figured out the problem. Thanks, anyway!

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: if function returning 0 when it should not

    I believe the formula is working fine both If and Hlookup the reason for zero result is the Hlookup result is blank and that is the reason the Hlookup is returning the value 0 instead of "". That is how the vlookup and hlookup works.

+ 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