Consulting

Results 1 to 2 of 2

Thread: Sleeper: Create table array for Vlookup with match and count to next blank row

  1. #1

    Sleeper: Create table array for Vlookup with match and count to next blank row

    I have a VBA that creates a summary sheet of about 20 tabs of Building data based on criteria. The summary sheet then list the Header (Building) and then the lines of account numbers and data. The same account numbers could be listed under different buildings - hence a traditional vlookup won't work (an account exists on all buildings but may not be on summary sheet). Managers take the summary sheet and insert comments. Now I need to get the comments they made BACK to the original Building tab. I would like to have a VBA that inserts the following vlookup formula into the same column on all Building spreadsheets and copy the comments back. How do I get Y to work below???


    This is how I want my vlookup to calculate - the second part of the table array is giving me problems:
    =vlookup (Acct#,$AX:$AY,3,0)
    X = MATCH(L9,A:A,0) - this works for me perfectly - gives me a number of where that text is (9 for example)
    Y = MATCH(L9,A:A,0) or 9 PLUS the number of rows under A9 until a blank - for example 4, which would return 13 - which would define the changing array.


    I cannot figure out a formula that tells it to start at A9 and count until the next blank row, and stop and return a number.


    Example picture (first Building should say BUILDING 1):
    Capture.jpg


  2. #2
    VBAX Expert Leith Ross's Avatar
    Joined
    Oct 2012
    Location
    San Francisco, California
    Posts
    552
    Location
    Hello amandacipra,

    Say your starting point is A9. You can use a Boolean array to find the first blank row and add that row number to the starting row number.
    =MATCH(TRUE,($A$9:$A$100=""),0)+ROW($A$9)-1
    Because this is an array formula, you must enter it using Ctrl+SHIFT+ENTER
    Sincerely,
    Leith Ross

    "1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •