Results 1 to 11 of 11

VBA coding a nested Vlookup, and a sumif formula

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-29-2008
    Location
    New York
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    145

    VBA coding a nested Vlookup, and a sumif formula

    I need help.

    I have this formula:

    =IF(ISERROR(VLOOKUP(IF(C3="",VLOOKUP(D3,Data!B:O,F3+2,0),IF(D3="",VLOOKUP(C3,Data!B:O,F3+2,0))),$O$3:$O$114,1,0)),H3&"C0MISCELLANEOUS",H3&(VLOOKUP(IF(C3="",VLOOKUP(D3,Data!B:O,F3+2,0),IF(D3="",VLOOKUP(C3,Data!B:O,F3+2,0))),$O$3:$O$114,1,0)))
    And I tried using this code to run instead of the formula above because the formula takes about 10 minute to run for worksheets, but it gives me #Value! at row 100.

    Sub Run_Data()
    Dim iLastRow As Long
    Dim i As Long
    
        With Sheets("Info1")
            iLastRow = .Cells(.Rows.Count, "F").End(xlUp).Row
            For i = 3 To iLastRow 'iLastRow to 1 Step -2
                .Cells(i, "K").Value = Evaluate("=IF(ISERROR(VLOOKUP(IF(C" & i & "="""",VLOOKUP(" & _
                    "D" & i & ",Data!B:O,F3+2,0),IF(D" & i & "="""",VLOOKUP(" & "C" & i & ",Data!B:O,F3+2,0))),$O$3:$O$114,1,0)),H" & i & "& ""C0MISCELLANEOUS"",H" & i & _
                    "&(VLOOKUP(IF(C" & i & "="""",VLOOKUP(D" & i & ",Data!B:O,F3+2,0),IF(" & "D" & i & "="""",VLOOKUP(C" & i & ",Data!B:O,F3+2,0))),$O$3:$O$114,1,0)))")
            Next i
        End With
    End Sub

    And how would I write a VBA Code to run from F7 to DN71 for the formula below:


    =SUMIF(Info1!$K$3:$K$43691,Summary!$A7&Summary!F$1,Info1!$I$3:$I$43691)+SUMIF(Info2!$K$3:$K$65536,Summary!$A7&Summary!F$1,info2!$I$3:$I$65536)
    I could have used a code similar to the code for the vlookup one above, but I'd have to do that code for too many column. I want a more flexible formula.

    I cross-posted or posted-multi posted because the code didn't give me the desired result and I needed a response quickly.
    And I think I got into a little bit of trouble. Well, that's what I get for not reading the rules.
    Thanks
    Xrull
    http://groups.google.com/group/micro...&q=dingo&pli=1
    http://www.mrexcel.com/forum/showthr...ighlight=xrull
    http://www.microsoft.com/office/comm...a-bced830f0d47
    Thanks,
    Xrull
    Last edited by Xrull; 01-24-2009 at 03:35 PM. Reason: no response

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