+ Reply to Thread
Results 1 to 7 of 7

Thread: VLOOKUP with nested IF statements?

  1. #1
    Registered User
    Join Date
    05-24-2010
    Location
    Boulder, CO
    MS-Off Ver
    Excel 2007
    Posts
    5

    VLOOKUP with nested IF statements?

    Hi, I was wondering if anyone could help me.

    I attached the document I am having trouble with. What I think I need is an IF statement nested in a VLOOKUP statement. I want to return the SCAR number it fits a certain number of criteria.

    For instance,
    if timestatus="Not yet completed"
    if # workdays open=AND(">0","<5")

    I want it to return the SCAR number of any that fit this criteria.

    I hope that was clear! Thanks in advance to anyone who can help
    Attached Files Attached Files
    Last edited by crockwell; 05-26-2010 at 11:25 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    251

    Re: VLOOKUP with nested IF statements?

    You could tweak Advanced Filter using VBA so that the SCAR numbers that meet the criteria are transferred to a different worksheet.

  3. #3
    Registered User
    Join Date
    05-24-2010
    Location
    Boulder, CO
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VLOOKUP with nested IF statements?

    When I try an Advanced Filter, I get an error message; "You can only copy filtered data to the active sheet.

  4. #4
    Forum Guru contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2010
    Posts
    1,342

    Smile Re: VLOOKUP with nested IF statements?

    Hi see attached
    HTH!!!! ))))
    Attached Files Attached Files
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, «Born in USSR»
    Vusal M Dadashev

    Baku, Azerbaijan

  5. #5
    Valued Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    251

    Re: VLOOKUP with nested IF statements?

    An alternative making use of Advanced Filter:

    Sub GetScar()
    
    lastrow2 = Sheet2.UsedRange.Rows.Count
    
    Sheet2.Range("A5:G" & lastrow2).EntireRow.Delete
    
    lastrow1 = Sheet1.UsedRange.Rows.Count
    
    Sheet1.Range("A1:G" & lastrow1).AdvancedFilter Action:=xlFilterCopy, _
    CriteriaRange:=Sheet2.Range("A1:B3"), CopyToRange:=Sheet2.Range("A5"), _
    Unique:=False
    
    End Sub
    See attached.
    Attached Files Attached Files
    Last edited by pb71; 05-24-2010 at 12:32 PM.

  6. #6
    Registered User
    Join Date
    05-24-2010
    Location
    Boulder, CO
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VLOOKUP with nested IF statements?

    Thank you so much!!

  7. #7
    Valued Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    251

    Re: VLOOKUP with nested IF statements?

    crockwell,

    A correction to my previous post:

    Sub GetScar()
    
    If Sheet2.UsedRange.Rows.Count > 4 Then
    Sheet2.Range("A5:G" & Sheet2.UsedRange.Rows.Count).EntireRow.Delete
    End If
    
    Sheet1.Range("A1:G" & Sheet1.UsedRange.Rows.Count).AdvancedFilter _
    Action:=xlFilterCopy, CriteriaRange:=Sheet2.Range("A1:C2"), _
    CopyToRange:=Sheet2.Range("A5"), Unique:=False
    
    End Sub
    Revised workbook attached.
    Attached Files Attached Files
    Last edited by pb71; 05-24-2010 at 01:49 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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.2.0