+ Reply to Thread
Results 1 to 11 of 11

VBA coding a nested Vlookup, and a sumif formula

  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:

    Please Login or Register  to view this content.
    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.

    Please Login or Register  to view this content.

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


    Please Login or Register  to view this content.
    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

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

    Bump no response

    Maybe the sample file might be clearer. I didn't put all the formulas in the file. It would be too big, and it takes a while to calculate.

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

    Attachment

    I'm having difficulty uploading the file

  4. #4
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949
    A sample file would be clearer, I'd recommend posting one.

    So your code works in terms of pasting this into the proper cells, but you're having problems with the formula, correct?

    EDIT
    Try copying the applicable pages into a new workbook, and posting that, I've had problems uploading entire spreadsheets before, that usually works.

    mew!
    Last edited by mewingkitty; 01-24-2009 at 03:48 PM.
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  5. #5
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949
    Please Login or Register  to view this content.
    If you're looking to post that formula in every cell range F7:DN71, that code will do it.

    Don't forget to read my above post.

    Oh, and as per your concern about writing a new code for every column, just put in a for/next loop, and make the integer which increases on each loop, the value of the column. That'll move it on down the line and keep running the same loop for each column. IE make x = 6, and have the column references refer to x instead of "F", then when it loops it'll be 7, aka column "G".

    EDIT:
    I have no life.
    Please Login or Register  to view this content.
    Please note that I've changed the name of the worksheet for the sake of making sure this worked properly. This is an example of what I meant by looping the column reference.

    Since this runs on the same sheet it pastes on, you'll get wonky results with it as is. I believe from what you've written so far though, you can see how it works. if you'd like to set a limit to how many columns to go through you can use the same sort of technique you've used previously, or just have it count the number of columns across the top row that aren't blank, and use that as the integer which replaces 100 in the for x = 6 to 100 loop.
    Last edited by mewingkitty; 01-24-2009 at 04:17 PM.

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

    Uploaded (crossing my fingers)

    Me again,
    The information on the pages info1 and info2 go beyond 30000 rows. Information is in Column C, but it would be found beyond row 10000.
    Mewingkitty, thanks I tried your formula, but it didn't work, or better yet, I don't know to implement the suggestion. I hope the file will help you to help me.
    Sheets info1 and info2 pick up data from the sheet named Data, and the Summary sheet picks up data from the info1 and info2 sheets.
    Xrull
    Attached Files Attached Files
    Last edited by Xrull; 01-24-2009 at 05:56 PM.

  7. #7
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Possibly a start.

    Otay, well that gives us somewhere to start anyways.

    As per your formula, try this in K3, and let me know if it gives the result you're looking for. I've gone through and I think I see what you were trying to do with it, I believe this performs the same function, and is much easier to follow.

    Please Login or Register  to view this content.
    There is one thing about your original formula which really confused me. You have a VLOOKUP which is returning a match from a single column array, in column 1. That's kinda like saying "Find the number 3 in this column, then tell me it's a 3".

    Let me know if that formula does what you want it to, and we'll go from there in terms of applying it through VBA. Figure it's best to start from the beginning.

    EDIT:
    VLOOKUP requires that your first column be sorted in order to return values properly, so I sorted the column in question for this to work.

    Alternatively, INDEX(MATCH...

    Can be used to accomplish the same thing without sorting.

    Please Login or Register  to view this content.
    Last edited by mewingkitty; 01-26-2009 at 10:14 AM.

  8. #8
    Registered User
    Join Date
    04-22-2006
    Posts
    29

    Re: VBA coding a nested Vlookup, and a sumif formula

    Xrull
    May be lets leave out the codes & functions out for a minute. may be lets pick it up from what do you expect info1 sheet to pick and info2 sheet to pick?. The summary on sheet seems to be ok.

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

    Re: VBA coding a nested Vlookup, and a sumif formula

    Me again,

    Okumu, Info1 and Info2 Sheets picks movements each month column "F" on the Info Pages give the month number. Column O on the Info Sheets represents the unique list of departments (sometimes the data entry is not correct so if the lookup doesn't catch it, it will be assigned miscellaneous, and corrected later. The Summary page sums up the information. The reason for the long round and about formula on the Summary page is: The information is too large to put on one sheet. God help me when I have to use another page.

    Mewingkitty, I'm working with Excel 2003 so I don't have the IFERROR function.
    Thanks again,
    Xrull

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

    Bump no response

    Well,
    I got some responses, but I don't know how to implement them.
    I've uploaded a file, but the numbers run beyond 40,000 lines. I tried zipping the file with more data, but I was unable to do that. I can email interested persons the file if it doesn't break the forum rules.
    Xrull

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

    Bump no response

    Well, here I am again, with this sheet that takes forever to calculate. I'm still experimenting, but with no success.
    The code
    Please Login or Register  to view this content.
    I got , from mewingkitty, still puts the formula in the cells, and I think it still takes too much time to calculate.
    And the other formula still jams up at cell row 100.
    Thanks for your help.
    Xrull

    And I haven't cross posted it again.

+ 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