+ Reply to Thread
Results 1 to 11 of 11

Can I add an IF statement

  1. #1
    Forum Contributor
    Join Date
    04-25-2006
    Posts
    215

    Can I add an IF statement

    I would like to know if I can add another IF statement to the following formula. For example IF cell H9 = "Day" then perform the function.

    Thanks.

    EP

    =IF(Date=0,"",OFFSET(Data!$E$5,ROW(A1)+100,MATCH(G8,Data!$F$3:$CT$3,0)))

  2. #2
    Registered User
    Join Date
    12-01-2005
    Posts
    45

    Red face

    Try -

    =IF(H9="Day",IF(Date=0,"",OFFSET(Data!$E$5,ROW(A1)+100,MATCH(G 8,Data!$F$3:$CT$3,0))),"What to do if H9 does not equal Day")

    That should work.

    You can 'nest' up to 7 IF statements in one formula - after that it can get a little more complicated.

    Regards,

    Rob

  3. #3

    RE: Can I add an IF statement

    "edwardpestian" wrote:
    > I would like to know if I can add another IF statement to the
    > following formula. For example IF cell H9 = "Day" then perform
    > the function.
    > [....]
    > =IF(Date=0,"",OFFSET(Data!$E$5,ROW(A1)+100,
    > MATCH(G8,Data!$F$3:$CT$3,0)))


    The short answer is: yes. But your intended logic is not clear.
    The following might what you really want:

    =if(or(Date=0, H9!="Day"), "", offset(...))

    In other words, compute offset(...) only if Date is non-zero __and__
    H9 is "Day". Alternatively, the following might be what you want:

    =if(and(Date=0, H9!="Day"), "", offset(...))

    That is, compute offset(...) if Date is non-zero __or__ H9 is "Day".

  4. #4
    macropod
    Guest

    Re: Can I add an IF statement

    Hi EP,

    Try:
    if either Date should <> 0 or H9 should = "Day":
    =IF(OR(Date=0,H9<>"Day"),"",OFFSET(Data!$E$5,ROW(A1)+100,MATCH(G8,Data!$F$3:
    $CT$3,0)))
    or, if both Date should <> 0 and H9 should = "Day":
    =IF(AND(Date=0,H9<>"Day"),"",OFFSET(Data!$E$5,ROW(A1)+100,MATCH(G8,Data!$F$3
    :$CT$3,0)))

    Cheers

    "edwardpestian" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > I would like to know if I can add another IF statement to the following
    > formula. For example IF cell H9 = "Day" then perform the function.
    >
    > Thanks.
    >
    > EP
    >
    > =IF(Date=0,"",OFFSET(Data!$E$5,ROW(A1)+100,MATCH(G8,Data!$F$3:$CT$3,0)))
    >
    >
    > --
    > edwardpestian
    > ------------------------------------------------------------------------
    > edwardpestian's Profile:

    http://www.excelforum.com/member.php...o&userid=33809
    > View this thread: http://www.excelforum.com/showthread...hreadid=539484
    >




  5. #5
    Forum Contributor
    Join Date
    04-25-2006
    Posts
    215

    I'll try to explain a little better

    Ultimaly what I'm trying to do is perform this calaculation but add in another criteria. For Example:

    If G8=Date AND G9="Day", then perform the following function. G8 will remain a constant; it will alws be a date, but H9 will Change.

  6. #6
    Forum Contributor
    Join Date
    04-25-2006
    Posts
    215
    I need all three sub criteria to perform the same function. Whatever the date in G9 is, and the shift in H9 is, then perform the function to look the data up.

    THe function works properly when I have it pull data based on the date (g9); but I cannot get it to work with the second critera.

    Thannks All:EP

    =IF(Date=0,"",OFFSET(Data!$E$5,ROW(A1)+100,MATCH(G8,Data!$F$3:$CT$3,0)))

  7. #7
    Forum Contributor
    Join Date
    04-25-2006
    Posts
    215

    Got this working, but....?

    Okay, so I've got the above formula below working as needed; but I need to add to it.

    I need it to perform the same OFFSET function, except with a change to the range. I need it to calculate based off of (A1)+101 IF H8<>"Swing"


    =IF(OR(Date=0,$H$8<>"Day"),"",OFFSET(Data!$E$5,ROW($A$1)+101,MATCH($G$8,Data!$F$3:$CT$3,0)))

    I'm stuck on this one for days...

    Thanks in advance for any help or feedback.

    EP

  8. #8
    Forum Contributor
    Join Date
    04-25-2006
    Posts
    215

    Got it working

    Okay All, I was able to get to work using the following:

    =IF($H$8="Day",OFFSET(Data!$E$5,ROW($A$1)+101,MATCH($G$8,Data!$F$3:$CT$3,0)),IF($H$8="Swing",OFFSET(Data!$E$5,ROW($A$1)+102,MATCH($G$8,Data!$F$3:$CT$3,0)),IF($H$8="Grave",OFFSET(Data!$E$5,ROW($A$1)+103,MATCH($G$8,Data!$F$3:$CT$3,0)))))

    Thanks for your help.

    EP

  9. #9
    Biff
    Guest

    Re: Can I add an IF statement

    Hi!

    Try this:

    =IF($H$8="","",OFFSET(Data!$E$5,MATCH($H$8,{"Day","Swing","Grave"},0)+101,MATCH($G$8,Data!$F$3:$CT$3,0)))

    Biff

    "edwardpestian" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Okay All, I was able to get to work using the following:
    >
    > =IF($H$8="Day",OFFSET(Data!$E$5,ROW($A$1)+101,MATCH($G$8,Data!$F$3:$CT$3,0)),IF($H$8="Swing",OFFSET(Data!$E$5,ROW($A$1)+102,MATCH($G$8,Data!$F$3:$CT$3,0)),IF($H$8="Grave",OFFSET(Data!$E$5,ROW($A$1)+103,MATCH($G$8,Data!$F$3:$CT$3,0)))))
    >
    > Thanks for your help.
    >
    > EP
    >
    >
    > --
    > edwardpestian
    > ------------------------------------------------------------------------
    > edwardpestian's Profile:
    > http://www.excelforum.com/member.php...o&userid=33809
    > View this thread: http://www.excelforum.com/showthread...hreadid=539484
    >




  10. #10
    Forum Contributor
    Join Date
    04-25-2006
    Posts
    215

    Great!

    Worked great Biff. And much more eloquent than my version.

    Thanks.

    EP

  11. #11
    Biff
    Guest

    Re: Can I add an IF statement

    You're welcome. Thanks for the feedback!

    Biff

    "edwardpestian" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Worked great Biff. And much more eloquent than my version.
    >
    > Thanks.
    >
    > EP
    >
    >
    > --
    > edwardpestian
    > ------------------------------------------------------------------------
    > edwardpestian's Profile:
    > http://www.excelforum.com/member.php...o&userid=33809
    > View this thread: http://www.excelforum.com/showthread...hreadid=539484
    >




+ 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