+ Reply to Thread
Results 1 to 7 of 7

INDEX, IF with AND causing #NUM! error

  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    Mineral, VA
    MS-Off Ver
    Excel 2003
    Posts
    73

    INDEX, IF with AND causing #NUM! error

    My formula to add a row to a worksheet worked fine, except for the fact that it was including items with 0%. I need items with >0% but <=50%.

    Here's the code that sorta works...
    Please Login or Register  to view this content.
    So I added an AND condition to my IF statement, as follows:
    Please Login or Register  to view this content.
    ...and I get a $NUM! error. I don't understand what problem I've caused since I'm usually pretty comfortable with the IF(AND combination.

    I've attached the file.
    Last edited by cedarhill; 03-12-2009 at 07:56 AM.

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

    Re: INDEX, IF with AND causing #NUM! error

    Try perhaps:

    Please Login or Register  to view this content.
    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.

  3. #3
    Registered User
    Join Date
    02-20-2009
    Location
    Mineral, VA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: INDEX, IF with AND causing #NUM! error

    Yes, it worked perfectly. Now comes the embarrassing part; I'm not familiar with the use of the " * " part in this situation.

    You probably don't have time to give me a lesson, but can you direct me to somewhere I can get an understanding of why/when you would use this and what it specifically means. Obviously it fulfills the need that I thought my IF(AND statement was supposed to take care of but didn't.

    Regardless, thanks very much.

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

    Re: INDEX, IF with AND causing #NUM! error

    When dealing with Array formulas, the * acts like the AND() function... whereas the + acts like the OR() function... the AND() and OR() functions don't work in Array formulas...

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: INDEX, IF with AND causing #NUM! error

    well i thought
    =IF(ROW($B3)-ROW($B$3)+1>$J$1,"",INDEX(Master!$B$1:$B$1000,SMALL(IF(Master!$X$3:$X$1000<=0,99999,IF(Master!$X$3:$X$1000<=0.5,ROW($A$3:$A$1000),99999)),ROW($B3)-ROW($B$3)+1)))
    only put it up coz its taken me 1/2 hour to puzzle out
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: INDEX, IF with AND causing #NUM! error

    Quote Originally Posted by martindwilson View Post
    well i thought
    =IF(ROW($B3)-ROW($B$3)+1>$J$1,"",INDEX(Master!$B$1:$B$1000,SMALL(IF(Master!$X$3:$X$1000<=0,99999,IF(Master!$X$3:$X$1000<=0.5,ROW($A$3:$A$1000),99999)),ROW($B3)-ROW($B$3)+1)))
    only put it up coz its taken me 1/2 hour to puzzle out
    The nested if is another way.... for the AND() option.. but then you are limited by number of nested functions....

  7. #7
    Registered User
    Join Date
    02-20-2009
    Location
    Mineral, VA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: INDEX, IF with AND causing #NUM! error

    That info really helps. And, more to the point, I actually understand it.

    Thanks (to you both).

+ 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