+ Reply to Thread
Results 1 to 6 of 6

Lookup Basic"s

  1. #1
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Lookup Basic"s

    I though i should have a play with some basic lookup functions.

    And i now understand the basic.
    =LOOKUP($C1,$A1:$A1,$B1:$B1)

    Though i wanted to rid the Na error from it when C is blank

    I seen a few ways, And wanted to try the method of using Countif becouse it can be used withen the same cell without using extra cells like another method i seen "=IF(ISNA(A1),0,A1)"

    what i know of countif
    This function counts the number of items which match criteria set by the user.
    =IF(COUNTIF($A1,"")),LOOKUP($C1,$A1:$A1,$B1:$B1),"")
    so how the heck can the countif function be used to rid the NA of a lookup. i just cant see a relationship between counting a lookup.

    Is there a better option that can be used withen the same cell formular.

    Thankyou.
    Last edited by D_Rennie; 08-30-2009 at 04:49 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Lookup Basic"s

    Without getting too deep into the actual formula you're using I would make the following points:

    1 - an IF works like:

    Please Login or Register  to view this content.

    2 - In XL only 0 = FALSE all other numeric values are TRUE

    so if the test results in a number you can use that number as the "boolean" test - ie is it true/false... it will be TRUE only if not zero

    Please Login or Register  to view this content.
    so the above says if there are blanks in the COUNTIF range then return a Null rather than conduct the LOOKUP.

    Quote Originally Posted by D_Rennie
    Is there a better option that can be used withen the same cell formular.
    There are simpler ways of testing based on contents of A1, eg COUNT / COUNTA depending on data type.

  3. #3
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Lookup Basic"s

    Hi D_Rennie,

    More on what DonkeyOte said:

    - - -

    When COUNTIF checks for a value in a list, and it finds no entries of that value, the count result is zero. This is a valid check result.

    When LOOKUP checks for a value in a list, and it finds no entries of that value, it must return an indication to say the value is not anywhere in the list, or "#NA".

    In an Excel IF statement, zero is also considered to equal "FALSE". If your IF statement truth test (the COUNTIF function) returns a zero, then the IF statement considers the test to be false and gives you the appropriate answer as "".

    If you're using Excel 2007, then you should be able to use the IFERROR function. From your example:

    Please Login or Register  to view this content.
    Hope that helps.

    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Lookup Basic"s

    The only real downside to an IFERROR based approach is that you're always conducting the formula, in this instance this may not be a big deal but if your formula becomes such that is "expensive" performance wise then in reality it is in your interests to avoid calculating unnecessarily in the first instance - ie if the determining factor is a quick efficient check elsewhere (IF(COUNT(A1),...)) then you should do that check initially via IF so as to avoid conducting the main "expensive" calculation which you know will only return an error.

    (IFERROR is also a "catch-all" handler but that can be saved for another day...)

  5. #5
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Lookup Basic"s

    Thankyou for the help.

    Understand it better now. I learn best by doing the hands on stuff, So ill read both your guys post a couple times and give the different ways a shot. I may be back with some follow up questions :;

    Cheers again.

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Lookup Basic"s

    Quote Originally Posted by DonkeyOte View Post
    (IFERROR is also a "catch-all" handler but that can be saved for another day...)
    Ok I have run the diffrent approahes in a workbook.

    I can see somethink that may pop its head up. Or then again there may never be a need for what im about to ramble on about.

    Though ive looked a little into iserror and what im guessing is if on a sheet there are many lookups, sums and all the other fancy stuff. if a formular is forced to show "" when if for some unforseen reason i want to cheek if all the cell formulars have been done without a error i cant use iserror to cheek that. and that got me thinking of what you ment by catch all.
    i guess if a cheek is to be made i guess that you wouldnt force a blank entry.
    I think i just answered my own question.

+ 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