+ Reply to Thread
Results 1 to 3 of 3

appending a Rows.count into a formula when the rows.count is from a diff worksheet

  1. #1
    Registered User
    Join Date
    01-26-2010
    Location
    united states
    MS-Off Ver
    Excel 2003/Excel 2007
    Posts
    27

    appending a Rows.count into a formula when the rows.count is from a diff worksheet

    I need to create a macro which reads a row count from one worksheet and have it append to a vlookup formula range in a different worksheet.

    For example, my formula would be
    "vlookup('cur'!c3,'prior'!c$3:AJ$896,1,false)" <-- the 896 value is the value I want to replace with the row count from a different worksheet column.

    Not sure how to go about this: confused:
    Last edited by mcg7@ntrs.com; 03-30-2010 at 02:31 PM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: appending a Rows.count into a formula when the rows.count is from a diff workshee

    Hi Mcg,

    If you have no data below row 896 (or your last used row in the lookup table), you could just leave off the row numbers, e.g.

    VLOOKUP('Cur'!C3,'Prior'!C:AJ,1,0)

    If you truly need the last row, you could use:
    Please Login or Register  to view this content.
    Also note that setting the third argument of VLOOKUP to 1 will simply return the matched value, or an error if that value isn't found. Alternatively you could use MATCH or ISNUMBER(MATCH.

  3. #3
    Registered User
    Join Date
    01-26-2010
    Location
    united states
    MS-Off Ver
    Excel 2003/Excel 2007
    Posts
    27

    Re: appending a Rows.count into a formula when the rows.count is from a diff workshee

    Hi Paul,

    I am so confused at the moment. I understand what you are saying, but I am having a difficult time incorporating it. The reason I say this is because, I trying to incorporate your logic into the logic which is produced when I record the macro. The recorded macro logic is not very straight forward, because this is the logic it creates:

    ActiveCell.FormulaR1C1 = _
    "=IF(ISNA(VLOOKUP('Cur Pool'!RC,'Prior Pool'!R3C:R896C[33],1,FALSE)),""1"",""0"")"
    Range("C3").Select
    Selection.AutoFill Destination:=Range("C3:C896")

    I am not sure how to incorporate your logic in replacing the 896 value with the ROWS.COUNT logic ???????

    Thx. Marie
    Last edited by mcg7@ntrs.com; 03-30-2010 at 12:49 PM.

+ 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