+ Reply to Thread
Results 1 to 10 of 10

VBA instead of index small or vlookup formula

  1. #1
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    VBA instead of index small or vlookup formula

    Hello,

    I have two sheets.

    Sheet1 = Matches go here
    Sheet2 = Database

    In the database I have values in column A, B, and C where A is the "identifier".
    I want too match the value in cell C2 in Sheet1 with the values in column A in Sheet2.
    I want to return the values column B and C in sheet2 and paste them into the range
    C8:C in sheet1

    I've only managed to return the 1st match from one column, but I want to return several matches
    from both columns.

    I want to use this as a sub routine with a button.

    Does anybody have a solution?

    Thanks!

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: VBA instead of index small or vlookup formula

    You may try something like this......
    Please Login or Register  to view this content.
    You may change the Sheet Names in red as per your actual sheet names.
    Does this help?
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    Re: VBA instead of index small or vlookup formula

    Quote Originally Posted by sktneer View Post
    You may try something like this......
    Please Login or Register  to view this content.
    You may change the Sheet Names in red as per your actual sheet names.
    Does this help?

    Hi!

    Thank you!

    But I get a "variable not defined" error on "i = 8".
    I've only changed the names on the sheets in the code.

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: VBA instead of index small or vlookup formula

    Declare i as long like
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    Re: VBA instead of index small or vlookup formula

    Works Great! Thanks man!

    Is it possible to modify the code so that the when I run the code several times with different values in C2 the
    previous results does not get replaced. Instead the new results go in the empty cells below the previous results?

    Would be awesome!

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: VBA instead of index small or vlookup formula

    In column C what values are there in the range C1:C7? Are they blank? Or which cell in col. C has value above C8 before running the code first time?

  7. #7
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    Re: VBA instead of index small or vlookup formula

    C7:I7 contain headers. so basic text values.
    Above that atea Form buttons and such.

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: VBA instead of index small or vlookup formula

    Ok try this.....
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    Re: VBA instead of index small or vlookup formula

    Worked perfectley! Thanks you so much! Saved me a headache.

  10. #10
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: VBA instead of index small or vlookup formula

    You're welcome.
    If that takes care of your question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.
    Moreover you may also click on * (star) to Add Reputation if the solution provided helped you. This is another way to say thanks.

+ 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. if, index, small - formula issue
    By jw01 in forum Excel General
    Replies: 6
    Last Post: 10-24-2012, 01:21 AM
  2. Replies: 2
    Last Post: 06-20-2012, 12:22 PM
  3. if(small(index...formula issue
    By jw01 in forum Excel General
    Replies: 7
    Last Post: 01-26-2012, 12:05 PM
  4. Replies: 1
    Last Post: 04-01-2011, 12:57 PM
  5. INDEX SMALL ROW Formula #REF! error.
    By elcasey125 in forum Excel General
    Replies: 3
    Last Post: 12-10-2008, 12:41 PM

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