+ Reply to Thread
Results 1 to 15 of 15

search table for unique values, return value and corresponding cell to another sheet

  1. #1
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    search table for unique values, return value and corresponding cell to another sheet

    Hi guys - I have been dabbling with vba for a little while now and normally I manage to find the answer pretty easily but with this one I am struggling (also been googling for days)

    so in my datasheet I have a table in the following format

    a b c d e f g
    1 aa ab ac af aa af 01/02/2016
    2 aa bb ff fc aa ff 13/05/2016
    3 gg ff aa af aa ff 17/11/2016

    (don't shout at me I haven't worked out how to put it in properly yet)

    A1:F3 contain a varity of codes, (aa,ab, etc) and column G contains a date.

    I need a way to get the first instance of each unique value along with the corresponding date in a list on a different sheet (reportsheet2)

    hopefully looking something like this

    a b
    1 aa 01/02/2016
    2 ab 01/02/2016
    3 ac 01/02/2016
    4 af 01/02/2016
    5 bb 13/05/2016
    6 ff 13/05/2016



    there is wayyyyyy more data than I have provided in this example just as a heads up

    I do have a little bit of code that has arranged the rows into date order but other than that I am stuck,


    any help would be greatly apreciated,

    Kind regards,

    T

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: search table for unique values, return value and corresponding cell to another sheet

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    Re: search table for unique values, return value and corresponding cell to another sheet

    Thanks!! I will give it a go

  4. #4
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    Re: search table for unique values, return value and corresponding cell to another sheet

    That works a treat!!!!

    how would I do it if I wanted to return row g and h?

    I tried

    but I feel like this was a total newbie mistake...

    Please Login or Register  to view this content.
    Thanks

    T

  5. #5
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    Re: search table for unique values, return value and corresponding cell to another sheet

    the sheet with the data on is on another sheet (sheet19) and I want to click a button on reportsheet 2 and get the list on report sheet 2

    I have solved the above issue by combining the two columns G and H in column I and using that instead of just G

    Thanks,

    T

  6. #6
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    Re: search table for unique values, return value and corresponding cell to another sheet

    it also comes up with type mismatch for i and j??

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: search table for unique values, return value and corresponding cell to another sheet

    You were on the right track.

    This will combine Sheet19 Columns G & H as a comma delimited text string. Then it pastes the results to column B and splits the column in two using the comma as a delimiter.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    Re: search table for unique values, return value and corresponding cell to another sheet

    ahh Cool!!

    Thanks so much!

  9. #9
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: search table for unique values, return value and corresponding cell to another sheet

    Great solution

  10. #10
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    Re: search table for unique values, return value and corresponding cell to another sheet

    why is it returning a type mismatch for Ubound(Vdata,1)?

  11. #11
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: search table for unique values, return value and corresponding cell to another sheet

    Quote Originally Posted by thara95 View Post
    why is it returning a type mismatch for Ubound(Vdata,1)?
    The data worksheet is empty or the data doesn't start in cell A1?

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    Re: search table for unique values, return value and corresponding cell to another sheet

    it doesn't start in Cell A1 it starts in E1 I did change it to E1 in that line but it still said type missmatch

    Thanks

    T

  13. #13
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: search table for unique values, return value and corresponding cell to another sheet

    Try this...

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    02-27-2017
    Location
    kent
    MS-Off Ver
    2007
    Posts
    41

    Re: search table for unique values, return value and corresponding cell to another sheet

    cool thanks!

  15. #15
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: search table for unique values, return value and corresponding cell to another sheet

    Good i am like it

+ 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. [SOLVED] search table for unique values return values and corresponding cells to a different sheet
    By thara95 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-01-2017, 09:04 AM
  2. Search table to return multiple values
    By Hayzylou in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-11-2017, 07:10 AM
  3. [SOLVED] Using INDEX MATCH to return unique values for non-unique search term
    By rico_suave in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 06-03-2015, 01:53 AM
  4. Formula to search for repeat values and return unique information
    By sccrbrg in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-19-2015, 10:47 PM
  5. [SOLVED] use 2 values on sheet 1 to search sheet 2 & return text on sheet 1
    By BlakeLee in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-02-2013, 04:56 PM
  6. Replies: 2
    Last Post: 01-21-2013, 12:07 AM
  7. Return Multiple Unique Values for Horiontal Table
    By sclost in forum Excel General
    Replies: 4
    Last Post: 01-09-2012, 10:30 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