+ Reply to Thread
Results 1 to 7 of 7

Consider only first matching and copy Row

Hybrid View

  1. #1
    Registered User
    Join Date
    06-28-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    27

    Consider only first matching and copy Row

    I need a formula in Sheet3 A1 that If A1 of Sheet1 is equal to any Cell of column A of Sheet2 than that Row should be copied to Row 1 of sheet3 and if A1 of Sheet1 matches to more than one cell of column A of Sheet2 than it should consider the first matching and should not take notice of other matching

    e.g If A1 of sheet1 matches A1540 of Sheet2 than all filled up Cells of Sheet 2 Row A1 should be copied to Sheet3 Row A1 and if it matches with e.g Sheet2 A1900 and A2600 than it should not take notice of that. It should take only first matching that is A1540.

    And I want to copy down the formula.

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Consider only first matching and copy Row

    Sheet3, A1:

    Formula: copy to clipboard
    =VLOOKUP(Sheet1!$A1,Sheet2!$A$1:$Xx$Xx,COLUMN(B1)-1,0)
    Change $A$1:$Xx$Xx to accommodate your full range of cells, then copy right and down as far as needed.

  3. #3
    Registered User
    Join Date
    06-28-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Consider only first matching and copy Row

    Thanks daffodil11, but I am a novice. Please let me know the exact formula. I have A1 To A15000 in sheet1 but A1 to A90000 in sheet2 and sheet 2 total filled up columns are up to column G.

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Consider only first matching and copy Row

    The exact formula you put in A1 of Sheet3 is this:

    =VLOOKUP(Sheet1!$A1,Sheet2!$A$1:$G$90000,COLUMN(B1)-1,0)

    Once it is entered, you copy and paste it out to column G, and down to row 15000.

  5. #5
    Registered User
    Join Date
    06-28-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Consider only first matching and copy Row

    it is showing the matches. But two things are not happening. First instead of deleting the unmatched rows, the unmatched cell of Column A are showing #NA. Second the rest of column upto G are coming blank. And what is the meaning of paste it out to column G. Does this mean the same formula to enter in all the columns upto G.

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Consider only first matching and copy Row

    I can't think of any way to autopopulate Sheet3 without first adding helper columns to Sheet1 to determine if Sheet1 values match Sheet2.

    Hopefully someone else can be of further assistance.

    edit: You could put a filter on Sheet3 and just filter out the #VALUE!
    Last edited by daffodil11; 07-26-2013 at 01:47 PM.

  7. #7
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Consider only first matching and copy Row

    Yes, the formula in A will be copied and pasted to all the other cells. Only certain parts of the range have absolute references, so the formula will adapt as you move it around.

    The same formula used in A1 copied into C5 will say:

    =VLOOKUP(Sheet1!$A5,Sheet2!$A$1:$G$90000,COLUMN(D5)-1,0)

    and it will pull the value of Sheet1!A5, and pull the corresponding data from the 4th column over on Sheet2.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 04-11-2013, 11:14 AM
  2. Replies: 2
    Last Post: 01-02-2013, 08:35 AM
  3. Copy Cell Value down For Each Matching Value in A
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-18-2009, 12:14 PM
  4. Copy matching lines
    By cbrd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-31-2005, 10:42 AM
  5. copy and paste matching by using ID's
    By annysjunkmail@tiscali.co.uk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-18-2005, 06:05 AM

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