+ Reply to Thread
Results 1 to 7 of 7

Writing an AND or OR statement

  1. #1
    Registered User
    Join Date
    05-14-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    32

    Writing an AND or OR statement

    I have columns A and B with dates in m/dd/yyyy format.
    I want to write an IF statement to say if A<=B, equal to "Pre" otherwise "Post"
    but i tried writing it in this way IF A<B, "Pre" otherwise "Post" and If A=B, "Post" otherwise "Pre".
    I keep running into trouble with this statement. only one part of this is correct and when the dates in the two columns are the same the statement doesnt work...

    Please Help!!

  2. #2
    Valued Forum Contributor
    Join Date
    05-13-2010
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    Excel 2003; 2007
    Posts
    441

    Re: Writing an AND or OR statement

    =if(a1<b1,"pre","post")
    ...If my answer helped you, Please, click on. * Add Reputation (at left)

    Best regards.
    Marc?lio Lob?o

  3. #3
    Registered User
    Join Date
    05-14-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Writing an AND or OR statement

    No, I tried that but that is not giving me what i need when A=B i want it to equal to "Post" not Pre.
    I only want "Pre" when A is less than B.

    Anyone else?? Thank you!

  4. #4
    Valued Forum Contributor
    Join Date
    05-13-2010
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    Excel 2003; 2007
    Posts
    441

    Re: Writing an AND or OR statement

    Thatīs exactly what this little formula does.

    IF A < B
    THEN "PRE"
    ELSE "POS"

    The ELSE clause includes A = B and A > B

  5. #5
    Registered User
    Join Date
    05-14-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Writing an AND or OR statement

    Ah very odd...it does work. you are right. I guess something was not right the first time i did it...
    Thank you so much!!

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Writing an AND or OR statement

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  7. #7
    Registered User
    Join Date
    05-14-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Writing an AND or OR statement

    Thank you! Got it.

+ 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. Help writing an IF Statement
    By Jah17 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-12-2013, 03:59 PM
  2. Help Writing IF Statement
    By sburque in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-12-2013, 01:56 PM
  3. [SOLVED] Writing an =if statement with contains
    By 1Monkey in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-12-2012, 12:21 PM
  4. IF Statement: How would I go about writing this
    By Bailey031285 in forum Excel General
    Replies: 2
    Last Post: 08-22-2011, 11:29 AM
  5. [SOLVED] Help writing an IF statement
    By cynichromantique in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-31-2006, 07:55 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