+ Reply to Thread
Results 1 to 7 of 7

Need to Return zero

  1. #1
    Registered User
    Join Date
    08-01-2008
    Location
    KENTUCKY
    Posts
    32

    Need to Return zero

    I need help, the formula below works with the exception that I would like it to return a 0 if False right now it is returning #NA. Can anyone see what I'm doing wrong?? Thanks for any help.

    =IF(COUNTIF(STYLE!$A$1:$A$2,"x"),VLOOKUP(D12,INDIRECT(INDEX(STYLE!$C$1:$C$2,MATCH("X",STYLE!$A$1:$A$2,0))),INDEX(STYLE!$D$1:$D$2,MATCH("X",STYLE!$A$1:$A$2,0)),FALSE),0)
    Last edited by kygwalt; 11-03-2014 at 09:07 AM.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Need to Return zero

    INDIRECTs are hard to troubleshoot without the workbook and if what is false?
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: Need to Return zero

    The first argument in your IF() function isn't a "logical test" where it needs to compare two values. The way it's set up, it's always going to return a value of TRUE, and therefore whatever value is in your VLOOKUP(). When a value cannot be found in a vlookup, it will return a "#N/A".
    Last edited by Craig K.; 11-03-2014 at 11:48 AM.
    Don't just use the answers provided for you. Try to understand how it works by reverse engineering or asking about it.

    Please mark the thread as [SOLVED] (Thread Tools->Mark thread as Solved) when answered.
    If you're happy with an answer given, please click the * under the person's name to boost their reputation.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Need to Return zero

    The conditional part of the if (the COUNTIF) will return 0 or a number greater than 0. 0 is False, and anything >0 is True, so that part will work.

  5. #5
    Registered User
    Join Date
    07-26-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Need to Return zero

    Can u upload sample data ?

  6. #6
    Registered User
    Join Date
    08-01-2008
    Location
    KENTUCKY
    Posts
    32

    Re: Need to Return zero

    I hope this attachment works. The formula is on sheet 3 column "E" Thanks

    ARCHITECTURAL PRICE AND WEIGHTS.xls

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Need to Return zero

    Do you need to refer to two Rows on the STYLE Sheet? I see no connection between the two rows with the "X"

    Maybe you want..

    =IF(D12="",0,IF(COUNTIF(STYLE!$A$1:$A$2,"x"),VLOOKUP(D12,INDIRECT(INDEX(STYLE!$C$1:$C$2,MATCH("X",STYLE!$A$1:$A$2,0))),INDEX(STYLE!$D$1:$D$2,MATCH("X",STYLE!$A$1:$A$2,0)),FALSE),0))

    else..

    =IF(COUNTIF(STYLE!$A$1:$A$1,"x"),VLOOKUP(D12,INDIRECT(INDEX(STYLE!$C$1:$C$2,MATCH("X",STYLE!$A$1:$A$2,0))),INDEX(STYLE!$D$1:$D$2,MATCH("X",STYLE!$A$1:$A$2,0)),FALSE),0)
    Life's a spreadsheet, Excel!
    Say thanks, Click *

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 11
    Last Post: 06-06-2014, 03:34 PM
  2. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 PM

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