Consulting

Results 1 to 3 of 3

Thread: IF Statement in EXCEL

  1. #1
    VBAX Regular
    Joined
    Jan 2005
    Posts
    10
    Location

    IF Statement in EXCEL

    I am having trouble with the following IF Statement



    I have 3 columns, Member Id & Begin Date & End Date...each member has multiple rows...I first sorted the sheet by Member Id and than Begin Date to order the document

    I would like to place the word "TRUE" on the following condition:

    -If a member has an End Date and than has another Begin Date within 0 to 7 days

    -I would like to put "TRUE" on both lines, with the Begin and End Date that qualified the member to be "TRUE"



    Here is what I have thus far, however, I am not able to get "TRUE" on Both lines

    =IF(((A2=A3)*AND(I3-J2<=7)),"TRUE","FALSE")


    Example:

    Member Id Begin Date End Date

    1 1/1/05 2/1/05 TRUE

    1 2/5/05 2/8/05 TRUE

    1 3/1/05 3/3/05 FALSE

    2 3/4/05 4/1/05 FALSE *member Id changed

  2. #2
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Hi Iamaterp,

    Try this:

    =IF(OR(AND(A2=A3,(I3-J2)<=7),AND(A2=A1,(I2-J1)<=7)),TRUE)
    .. in row 2 and copy down (you can't put it in row 1)
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  3. #3
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    Quote Originally Posted by Iamaterp
    =IF(((A2=A3)*AND(I3-J2<=7)),"TRUE","FALSE")
    I'll leave you to figure out the logic, but your syntax is not going to work. Here are a couple ways to proceed:

    =IF(AND((A2=A3),(I3-J2<=7)),TRUE,FALSE)
    =IF(A2=A3,if(I3-J2<=7,TRUE,FALSE),FALSE)
    Notice also I've changed from text strings for "TRUE" and "FALSE" to the Boolean TRUE and FALSE.

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com/
    _______

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •