+ Reply to Thread
Results 1 to 8 of 8

LOOKUP formula help - choppy formula ..how to make it more efficient?

  1. #1
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    LOOKUP formula help - choppy formula ..how to make it more efficient?

    Hi all, I am having some trouble with LOOKUP formula. What am I doing wrong here?

    The formula I use, looks up specific value based on 2 identifiers.

    The problem:
    1) When my data gets transferred in K3.. I need to drag it down all the way down..which i have implemented in the code below.. lets says I have 100 rows in my 1st tab and it looks up against other tab where it has 250 rows.. the problem I have is although it transfers the correct data, it keeps dragging down past 100 rows and brings remaining 150 values(as 0 though because it did not find the matches I assume)

    2) the number of rows change daily.. currently I have it set 3:10001. Is there any way to incorporate Last Row into this so it scans everything up to last row? skipping blanks ofcourse..

    Please Login or Register  to view this content.
    Any ways around these 2 issues?

    Thanks so much
    Last edited by donyc; 03-25-2011 at 02:44 PM. Reason: subject name amendment

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: LOOKUP formula help - choppy formula ..how to make it more efficient?

    Hi donyc
    Try....
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    Re: LOOKUP formula help - choppy formula ..how to make it more efficient?

    Hi Pike, I tried it but it does not drag down the formul all the way down for me..below is the full code I use



    Please Login or Register  to view this content.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: LOOKUP formula help - choppy formula ..how to make it more efficient?

    It looks like you're getting a "lastrow" answer from one sheet. If you want to apply the formula on the second sheet to a specific "lastrow" on that sheet, you would need to add another variable.

    Add a "LastRow2" variable an solve it on the second sheet, then insert that variable into the second half of your paste range.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    03-24-2011
    Location
    Wirral
    MS-Off Ver
    Excel
    Posts
    6

    Re: LOOKUP formula help - choppy formula ..how to make it more efficient?

    ive got a formula which looks up on a pivot table but i wish to replace one fo the fields to represent a square on the file, which in turn i could change and then this would then change which dats field it looks up on the pivot chart ?

    is this possible ?

    basically,

    =GETPIVOTDATA("Value",Pivot!$A$4,"Day","Mon","Wk Yr","201112","A/C Desc","Dry")


    this is the formula and i wish to change the 201112 to represent the figure which is imputted into square f19 ?

  6. #6
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    Re: LOOKUP formula help - choppy formula ..how to make it more efficient?

    didn't work .. shouldnt the below in red be applied based on last row in the sheet I am inputting the formula in? why is it referring last row from sheet2? I never defined lastrow there..

    Dim LastRow2 As Long
    LastRow2 = Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row

    Please Login or Register  to view this content.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: LOOKUP formula help - choppy formula ..how to make it more efficient?

    You dimmed the Lastrow2 variable, that's good. But then you fill in the variable right away at the top of the macro. Are you sure you're on the correct sheet when you store that number? Add a reference to that command so we know it's being applied to the correct sheet at the correct time.

    Also, I thought you needed the original LastRow reference for something else. Don't you? I thought we were adding a new variable here, not just replacing the old, no point in that, really.

  8. #8
    Forum Contributor
    Join Date
    08-31-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    204

    Re: LOOKUP formula help - choppy formula ..how to make it more efficient?

    I got it to work.. I ended up inserting
    LastRow = Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
    right before running the formula

+ 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