Results 1 to 5 of 5

Thread: IF Function ignoring NA
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Aug 2019
    Posts
    17
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default IF Function ignoring NA

    Hello guys,

    I am currently processing a huge dataset. My question is that how can I ignore NA when I want to run and repeat this function in excel.
    Code:
    =IF(AND(RankLN!D45>0.3,RankLN!D45<=0.7),"M",IF(RankLN!D45>0.7,"W","L"))
    In detail, for example, I have a column, we say column D. In this column, I have huge number of values between 0-1 and some NA, what I need to do is to rank and divide 0-1 using 'W', 'M', 'L'. However, in this column I have NA, so how can I ignore NA?

    Thank you so much
    Last edited by Rookieeee; Aug 31st, 2019 at 01:26 AM.

  2. #2
    Board Regular Michael M's Avatar
    Join Date
    Oct 2005
    Location
    South Western NSW
    Posts
    17,806
    Post Thanks / Like
    Mentioned
    18 Post(s)
    Tagged
    2 Thread(s)

    Default Re: IF Function ignoring NA

    Maybe this

    Code:
    =IF(RankLN!D45="NA","",IF(AND(RankLN!D45>0.3,RankLN!D45<=0.7),"M",IF(RankLN!D45>0.7,"W","L")))
    Regards
    Michael M
    ---------------------------------------
    The more I learn, the less I seem to know.....A Please and Thank You cost nothing !
    It's easier to debug if we can see the whole macro !
    Home 2007 & 2013

    - Posting guidelines, forum rules and terms of use

    - To download Mr Excel HTML Maker

    - Try searching for your answer first, see how

    - Read the FAQs

    - List of BB codes


    [CODE]Place Your Code Here[/CODE]

  3. #3
    New Member
    Join Date
    Aug 2019
    Posts
    17
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: IF Function ignoring NA

    Quote Originally Posted by Michael M View Post
    Maybe this

    Code:
    =IF(RankLN!D45="NA","",IF(AND(RankLN!D45>0.3,RankLN!D45<=0.7),"M",IF(RankLN!D45>0.7,"W","L")))
    It works, Thank you so much.

    Cheers,

  4. #4
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: IF Function ignoring NA

    Quote Originally Posted by Rookieeee View Post
    It works,
    In that case your "NA" values must be text as opposed to actual error values like in your other thread with the same title?

    BTW, for the formula being discussed in this thread,
    - what is the name of the worksheet that it is on?
    - are there any values in column D actually equal to 0 and/or 1 or are they all "between" as you described in post 1 here?
    Last edited by Peter_SSs; Aug 31st, 2019 at 01:52 AM.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  5. #5
    Board Regular
    Join Date
    Dec 2008
    Posts
    6,646
    Post Thanks / Like
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default Re: IF Function ignoring NA

    Another way that you could do it.

    =IFERROR(INDEX({"W","M","L"},MATCH(RankLN!D45,{1,0.7,0.3},-1)),"")

    or possibly (decimal precision might need adjusting).

    =IFERROR(LOOKUP(RankLN!D45,{0,0.30001,0.70001},{"L","M","W"}),"")

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •