+ Reply to Thread
Results 1 to 8 of 8

OR Formula

  1. #1
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    OR Formula

    Hi,

    I have a spreachsheet that contains postcode data.

    Some of my formulas are:
    :
    In cell C2 =IF(A2="","",OR(I2="CITY",B2="YES"))
    In cell D2 =IF(C2=TRUE,"YES","NO")
    In cell I2 =IF($A2="","",INDEX(DISTRICT,MATCH(Sheet2!A2,POSTCODES,0)))

    I would like the formula in C2 if possible to display directly Yes or No and not True or false so I can delete column D.

    The problem that I seem to have is in cell C2 the or function doesnt work as the value in cell I2 contains a formula and doen't match to my (I2=City). If I type manually in cell I2 the formula and type "City" then the formula correspond.

    Another issue that I have is that In column D once I paste down the formula I would like to leave it blank and not display the value "No" as the cells in column A are blank.

    Another question that I would like to ask is why my file is approx 3MB while it only contains a small amount of data?

    I have attached a copy of my spreadsheet. If you need any additional info please let me know.

    Many thanks
    Attached Files Attached Files
    Last edited by greekboyuk; 05-15-2010 at 04:04 AM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: OR Formula help!!

    Try making C2

    =IF(A2="","",IF(OR(I2="CITY",B2="YES"),"Yes","No"))

    "CITY" doesn't match because in your data CITY has a "trailing space", I suggest you edit the table

  3. #3
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: OR Formula help!!

    Greek,

    I updated your spreadsheet. Let me know if this works for you.
    Attached Files Attached Files
    Last edited by day92; 05-14-2010 at 11:08 AM. Reason: did not upload

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: OR Formula help!!

    Try this,

    C2=IF(A2="","",IF(OR(SUBSTITUTE(I2,CHAR(160),"")="CITY",B2="YES"),"YES","NO"))

    Regards

  5. #5
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    Re: OR Formula

    Hello,

    Thank you everyone for the help. The code that works for me is the one from sailepaty...thank you very much. how did u do it? what that substitute stands for?

    Many thanks

  6. #6
    Forum Contributor
    Join Date
    08-11-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    149

    Re: OR Formula

    CHAR(160) is a space, so it's replacing all spaces with nothing (the "" is effectively a nul text).

    The only problem w/ that solution is if you're ever trying to match against something that SHOULD have a space in it. An alternative solution would be the TRIM() function which removes all extra spaces except single spaces between words.

  7. #7
    Valued Forum Contributor
    Join Date
    02-08-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: OR Formula

    CHAR(160) is a non-break space used for the system were you get the data from. It cannot be remove with the TRIM or CLEAN functions, that’s why we have to use the SUBSTIUTE function.

    Regards

  8. #8
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    Re: OR Formula

    Many thanks for your help. All of you have been great, especially sailepaty that came up with his clever formula.
    I would like to say many thanks to day92 for sorting my data.


    Kind regards

    greekboyuk

+ 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