Results 1 to 2 of 2

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

  1. #1

    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):

  2. #2
    VBAX Expert Leith Ross's Avatar
    Oct 2012
    San Francisco, California
    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.


    Because this is an array formula, you must enter it using Ctrl+SHIFT+ENTER
    Leith Ross

Posting Permissions

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