+ Reply to Thread
Results 1 to 6 of 6

Nested IF or VB Script

Hybrid View

  1. #1
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Nested IF or VB Script

    Hi,

    I request you to help in getting a formula or VB Script for my requirement.
    In the attached sample file I need a condition which should look in column H & G and give
    the result as YES or NO in Column I.

    The following are the conditions it shd check.

    If Column H is 1 then it needs to check in Column G and if it is > 4 it should give NO else YES in column I
    If Column H is 2 then it needs to check in Column G and if it is > 8 it should give NO else YES in column I
    If Column H is 3 then it needs to check in Column G and if it is > 72 it should give NO else YES in column I
    If Column H is 4 then it needs to check in C'olumn G and if it is > 120 it should give NO else YES in column I

    Regards,
    Pradeep Kodali
    Attached Files Attached Files
    Last edited by pradeepkodali; 09-03-2011 at 04:05 PM.

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Nested IF or VB Script

    Try,

    =CHOOSE(H2,IF(G2>4,"No","Yes"),IF(G2>8,"No","Yes"),IF(G2>72,"No","Yes"),IF(G2>120,"No","Yes"))
    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  3. #3
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Nested IF or VB Script

    Hi,

    Thanks for your reply. But its not giving the exact result. Please have a check.

    Even it should check for the condition in Column H (either 1 or 2 or 3 or 4).

    Regards,
    Pradeep Kodali

  4. #4
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Nested IF or VB Script

    What units are 4, 8, 72, & 120?

    If hours, then try:

    =CHOOSE(H2,IF(G2>4/24,"No","Yes"),IF(G2>8/24,"No","Yes"),IF(G2>72/24,"No","Yes"),IF(G2>120/24,"No","Yes"))
    Last edited by ConneXionLost; 08-31-2011 at 07:19 PM.

  5. #5
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Nested IF or VB Script

    Those are the time units.
    Last edited by pradeepkodali; 08-31-2011 at 07:43 PM.

  6. #6
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Thumbs up Re: Nested IF or VB Script

    Thanks a LOT for your swift response . Its working now.

+ 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