+ Reply to Thread
Results 1 to 2 of 2

IF(OR( Formula not adding correctly

  1. #1
    Registered User
    Join Date
    04-19-2013
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    1

    IF(OR( Formula not adding correctly

    I am trying to get a percentage of cells in a range that have "y" in the cell. The cells may have "y," "n," or "x" standing for complete, not complete, or not applicable. My formula is returning "#VALUE!"

    Here is the formula:

    =IF(OR(B6:B20="y",B6:B20="n"),COUNTIF(B6:B20,"y")/(COUNTIF(B6:B20,"y")+COUNTIF(B6:B20,"n")),1)

    I added the "1" to the not true value if false so that it wouldn't be dividing by zero, but it still isn't working. Can someone please tell me what I am doing wrong?

    Thanks,
    Matthew Wilson

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: IF(OR( Formula not adding correctly

    your testing a range of cells for Y or N

    why does
    =COUNTIF(B6:B20,"y")/((COUNTIF(B6:B20,"y")+COUNTIF(B6:B20,"n")))
    not work for you - Not sure what the IF condition is trying to do here



    you could use an iferror
    =IFERROR(COUNTIF(B6:B20,"y")/((COUNTIF(B6:B20,"y")+COUNTIF(B6:B20,"n"))),1)
    so if you get a div0 error it will give an answer of 1 - which I would not think you want "" will just leave the cell blank

+ 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