+ Reply to Thread
Results 1 to 8 of 8

If with numeric .AND. character?

  1. #1
    Registered User
    Join Date
    04-21-2016
    Location
    Albuquerque, NM
    MS-Off Ver
    2010
    Posts
    3

    If with numeric .AND. character?

    In an IF argument, can I mix numeric criteria with character? Formula example
    =IF(OR(Coders!AF2-Coders!W2=0,Coders!W2="No Entry"),"No","Yes")
    returns correctly, except when W2="No Entry" then it returns #VALUE!

    Is there a way around this?
    Mad

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If with numeric .AND. character?

    Maybe this...

    =IF(OR(Coders!AF2-N(Coders!W2)=0,Coders!W2="No Entry"),"No","Yes")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: If with numeric .AND. character?

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    When Coders!W2 has "No Entry" in it, you cannot subtract that value from Coders!AF2
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: If with numeric .AND. character?

    I would do this:

    =IF(Coders!W2="No Entry","No",IFERROR(IF(Coders!AF2-Coders!W2=0,"No","Yes"),"No"))

    Your error has nothing to do with an IF; you are trying to do arithmetic on a text string and getting an error. Here's the long version:

    In an IF here are the arguments

    IF([condition],[result when condition is TRUE],[result when condition is FALSE])

    So [condition] is any expression that evaluates to either TRUE or FALSE.

    Similarly in OR

    OR([condition1], [condition2], [condition3],....[conditionn])

    where each [conditionx] evaluates to TRUE or FALSE.

    Your OR function has this as a condition

    Coders!AF2-Coders!W2=0

    If W2 is "No Entry" then it doesn't make sense to do arithmetic on it. I would suggest this:

    =IF(Coders!W2="No Entry","No",IF(Coders!AF2-Coders!W2=0,"No","Yes"))

    If W2 is not "No Entry" but is some other text instead you will still get an error. So you could do this to cover all your bases:

    =IF(Coders!W2="No Entry","No",IFERROR(IF(Coders!AF2-Coders!W2=0,"No","Yes"),"No"))
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    04-21-2016
    Location
    Albuquerque, NM
    MS-Off Ver
    2010
    Posts
    3

    Re: If with numeric .AND. character?

    AWESOME! That worked and you explained IFERROR too. Thanks so much for your help.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: If with numeric .AND. character?

    Glad to help, and thanks for the rep.

    Also thanks for remembering to mark your thread SOLVED.

  7. #7
    Registered User
    Join Date
    04-21-2016
    Location
    Albuquerque, NM
    MS-Off Ver
    2010
    Posts
    3

    Re: If with numeric .AND. character?

    I would like to use this formula in a VLOOKUP. How would I modify it? I have trouble with nesting conditions.

    =VLOOKUP(f2,Coders!F:AB,(=IF(Coders!W2="No Entry","No",IFERROR(IF(Coders!AF22-Coders!W2=0,"No","Yes"),"No"))),False)

    or, should I submit a new request?
    Mad

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: If with numeric .AND. character?

    That's not the correct syntax for VLOOKUP. You stuck that big IF formula in where VLOOKUP is expecting a positive number. What you need to accomplish with your VLOOKUP?

+ 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. [SOLVED] 3 Character Alpha Numeric Permutations
    By N8237 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2012, 10:00 PM
  2. finding a numeric character in a string using VB
    By AH Udupa in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-17-2010, 09:53 AM
  3. Replies: 4
    Last Post: 06-03-2010, 08:23 AM
  4. Separate at first numeric character
    By sandersonsea in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-13-2009, 05:17 AM
  5. Keeping only numeric character?
    By ryanjensen03 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-27-2008, 02:54 PM
  6. Assigning a numeric value to a alpha character
    By Johnny D in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2006, 03:10 PM
  7. [SOLVED] Determine if a character is numeric or non-numeric
    By AP in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2005, 05:06 AM
  8. Determine if character is text or numeric?
    By Ed in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2005, 08: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