+ Reply to Thread
Results 1 to 6 of 6

"OR" Function Results in Error

  1. #1
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    259

    Question "OR" Function Results in Error

    Good afternoon,

    I'm trying to use the OR function nested within the IF function to determine whether a cell is an error or a negative value. Below is what I've tried, but the result is "#N/A" when the value in A2 is an error, not the "A" I'd expect. I do, however, get the "Z" result when the value in A2 is a positive number. Any idea where I'm going wrong here?

    =IF(OR(ISERROR(A2),A2<0),"A","Z")

    Thanks in advance for your help!

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: "OR" Function Results in Error

    because =IF(OR(ISERROR(A2),A2<0),"A","Z") error is error and it is not less than 0

    you can try
    =IF(OR(ISERROR(A2),IFERROR(A2,0)<0),"A","Z")
    but I don't know what you want to achieve.

    For A2 value = an error it doesn't matter what will be in the second parameter. It must be Boolean value, ie. TRUE or FALSE (1 or 0) but result of OR() will be TRUE (1)
    in details:
    A2=#N/A
    so
    OR(ISERROR(A2),....
    ISERROR(#N/A) = TRUE

    and you will get always A from IF()
    If you want Z, both parameters of OR() should be FALSE
    Last edited by sandy666; 05-05-2017 at 02:56 PM.

  3. #3
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    259

    Re: "OR" Function Results in Error

    Thanks for the reply! Your solution seems to have done the trick, but I'm not sure I understand why it works or why my initial formula didn't. Mine essentially says" "If A2 is an error OR if A2 is a number less than zero, give me "A", if neither of those are true, give me "Z." Am I not able to perform an OR on a single cell if that OR tests for two different data types?

    =IF(OR(ISERROR(A2),A2<0),"A","Z")

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: "OR" Function Results in Error

    eg. A2=#N/A

    OR(ISERROR(#N/A),#N/A<0)
    first parameter = TRUE
    second parameter will be an error so you need change error to Boolean value like I said above

    Function OR() works with Boolean values: TRUE / FALSE
    so
    OR(TRUE, TRUE) = TRUE
    OR(TRUE, FALSE) = TRUE
    OR(FALSE, FALSE) = FALSE
    Last edited by sandy666; 05-05-2017 at 03:07 PM.

  5. #5
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    259

    Re: "OR" Function Results in Error

    I guess that makes the kind of cold, literal sense I've come to expect from computer logic. Anyway, like I said, your solution works, so thank you kindly!

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: "OR" Function Results in Error

    You are welcome

    If problem is resolved read my dancing (here or above) footnote. Thanks
    Last edited by sandy666; 05-05-2017 at 03:21 PM.

+ 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. Opening specific Workbook results in ambiguous "400" error
    By twfreeeman in forum Excel General
    Replies: 2
    Last Post: 01-18-2017, 11:37 AM
  2. Replies: 35
    Last Post: 01-13-2016, 02:16 AM
  3. Getting "this function takes no arguments" and "#NAME?" error
    By chuckmckiel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-31-2014, 01:58 PM
  4. = EMBED("Forms.ComboBox.1","") error "Reference not valid."
    By CatharinaCatharina in forum Excel General
    Replies: 2
    Last Post: 12-11-2014, 09:58 AM
  5. Excel file results in error "not valid web page "
    By Paddmini in forum Excel General
    Replies: 0
    Last Post: 10-30-2014, 07:49 AM
  6. [SOLVED] Need help: My function results in #VALUE error when "Left" funtion is used.
    By kdearing24 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2013, 05:52 PM
  7. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM

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