+ Reply to Thread
Results 1 to 9 of 9

search table for unique values return values and corresponding cells to a different sheet

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

    Unhappy search table for unique values return values and corresponding cells to a different 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
    Last edited by thara95; 03-01-2017 at 12:15 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: search table for unique values return values and corresponding cells to a different sh

    If you've got the data in date order....and you're looking for the first instance of each value (you say unique value but I don't think you mean that, from your results it looks like you want the first time every value appears, not just the unique ones).....then:

    Use a for next loop to cycle down through your data, on every row you stop and compare the value in column B with all the values in the list you're making, if a value is not in the list then add it together with the date from column G. If a value appears more than once then it'll already be in the list when your cycle reaches the second instance.

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

    Re: search table for unique values return values and corresponding cells to a different sh

    I think I mean Distinct?

    And how would I do that?

    really sorry I am properly stuck on this

    Kind regards,

    Thara

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

    Re: search table for unique values return values and corresponding cells to a different sh

    I currently have this and after that I am massively stuck

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: search table for unique values return values and corresponding cells to a different sh

    You don't want to scan the whole row, just the column with the data in.

    so...

    Please Login or Register  to view this content.

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

    Re: search table for unique values return values and corresponding cells to a different sh

    thanks,

    Why doesn't it like the first bit

    Please Login or Register  to view this content.
    and guessing I add this for all Columns?

    Kind regards,

    T
    Last edited by thara95; 02-28-2017 at 11:59 AM. Reason: COLUMNS NOT ROWS

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

    Re: search table for unique values return values and corresponding cells to a different sh

    it doesn't like the range?

  8. #8
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: search table for unique values return values and corresponding cells to a different sh

    range("ThisSheet!A1048000")


    is your worksheet actually named "ThisSheet"? Change it to the actual sheet name and it'll work.

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

    Re: search table for unique values return values and corresponding cells to a different sh

    i changed it to the actual sheet number...

+ 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. Search table to return multiple values
    By Hayzylou in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-11-2017, 07:10 AM
  2. Replies: 4
    Last Post: 10-01-2015, 11:01 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. Replies: 1
    Last Post: 04-11-2013, 01:02 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

Tags for this Thread

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