+ Reply to Thread
Results 1 to 9 of 9

Using OR syntax

  1. #1
    Registered User
    Join Date
    09-17-2015
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    72

    Using OR syntax

    I am trying to use the following OR syntax:

    =if(or(b2="RW","MW","WZ","WZk","Expenditure","Income"))

    where is B2 I have one of the values noted in the brackets. For some reason I get an error for the OR syntax.

    Please assist.

    Thanks,
    Shai

  2. #2
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Using OR syntax

    perhaps

    =IF(OR(B2={"RW","MW","WZ","WZk"}),"Expenditure","Income")
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  3. #3
    Registered User
    Join Date
    09-17-2015
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Using OR syntax

    It gives me the "Income" rather than "Expenditure", although in cell B2 I have a value of "RW".

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Using OR syntax

    But it is working here ok. Do check again

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Using OR syntax

    You've may have a space or CHR(160) in B2, henc "RW " does not equal "RW"

    in a blank cell enter
    =(B2="RW")
    If it says FALSE then B2 is definitely not "RW"
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  6. #6
    Registered User
    Join Date
    09-17-2015
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Using OR syntax

    I have no left space, and it still does not work.

  7. #7
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Using OR syntax

    Please provide spreadsheet

  8. #8
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: Using OR syntax

    What shukla said - all 3 times. And adding to Special-K, a technique I use is something like
    a5=1
    a6=a5+1
    a7=a6+1
    etc., copied down

    b5=code(mid($B$2,a5,1))
    and copy down
    Then at least I see the true ASCII content of B2. Sometimes it awakens me to the letter 'ell' (l) vs. one(1), or 0 vs. O, etc.
    Chip, if you can read this, you're STILL making the world a better place with your immeasurably valuable gifts. Every week, you continue to help me (and untold numbers of others) tremendously. Practically no alternative outlets can match your effectiveness, even over the vast number of topics you demystify and empower usage of. You were, and still are, amazing.

  9. #9
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: Using OR syntax

    Hi shaibn,

    Perhaps you need wildcard:
    =IF(SUM(COUNTIF(B2,"*"&{"RW","MW","WZ","WZk"}&"*")),"Expenditure","Income")

    or with simplified:
    =SIGN(SUM(COUNTIF(B2,"*"&{"RW","MW","WZ","WZk"}&"*")))

    Format the cell as:
    "Expenditure";;"Income"

    Blessing
    Last edited by Khalidngo; 03-03-2016 at 04:03 AM.

+ 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] for...next syntax
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2015, 11:26 AM
  2. Syntax
    By fatbassman in forum Excel General
    Replies: 9
    Last Post: 10-13-2013, 05:48 PM
  3. Need syntax
    By jaganexcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2013, 09:06 AM
  4. syntax help
    By vincenzo345 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2013, 05:02 PM
  5. VBA Syntax Help
    By scottylad2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-31-2011, 08:18 PM
  6. Syntax
    By adilhooda in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2007, 07:11 PM
  7. syntax???
    By hvisa in forum Excel General
    Replies: 0
    Last Post: 04-11-2007, 09:14 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