+ Reply to Thread
Results 1 to 5 of 5

Listing unique values, based on matching two other columns in a single cell

Hybrid View

bsamson05 Listing unique values, based... 02-17-2016, 12:11 PM
Czeslaw Re: Listing unique values,... 02-17-2016, 02:18 PM
José Augusto Re: Listing unique values,... 02-17-2016, 02:51 PM
hemesh Re: Listing unique values,... 02-17-2016, 02:59 PM
bsamson05 Re: Listing unique values,... 02-17-2016, 03:36 PM
  1. #1
    Registered User
    Join Date
    02-17-2016
    Location
    Syracuse, NY
    MS-Off Ver
    2010
    Posts
    4

    Listing unique values, based on matching two other columns in a single cell

    I have the following info in an IMPORT sheet:

    Date	        route	City
    2/1/2016	Albany	Latham
    2/1/2016	Albany	Loudonville
    2/1/2016	Albany	Albany
    2/2/2016	Albany	Schenectady
    2/2/2016	Albany	Voorheesville
    2/2/2016	Albany	Schenectady
    2/2/2016	Albany	Schenectady
    2/2/2016	Albany	Schenectady
    2/2/2016	Albany	Schenectady
    2/2/2016	Albany	Hagaman
    2/2/2016	Albany	Schenectady
    2/2/2016	Albany	Latham
    2/2/2016	Albany	Latham
    2/3/2016	Albany	Chatham
    2/3/2016	Albany	Hudson
    2/3/2016	Albany	Catskill
    2/3/2016	Albany	Schenectady
    I have searched and have been unable to find a formula or some means to list the unique cities, based on matching the route and date - in a cell, separated by commas.

    I am very sorry if the answer exists, but I have not found a solution in searching these forums or google.

    I have another sheet with the following info and am looking to get the info in RED and listed like this:

    A              B             C
    Date	        Truck	       Areas Serviced
    2/1/2016	Albany      Albany, Latham, Loudonville

    Thank you in advance for any direction!

  2. #2
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,405

    Re: Listing unique values, based on matching two other columns in a single cell

    Maybe a suitable option.
    Attached Files Attached Files

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Listing unique values, based on matching two other columns in a single cell

    Hi
    I suppose that you must use VBA.
    Try these code in a module
    Option Explicit
    Function Areas_Served(data As Range, Date_Sel As Date, Truck As String) As String
    Dim x As String, i As Long, j As Long
        x = ""
        For i = 1 To data.Rows.Count
            If data(i, 1) = Date_Sel And data(i, 2) = Truck Then
                x = data(i, 3) & ", " & x
            End If
        Next i
        Areas_Served = IIf(Len(x) > 1, Left(x, Len(x) - 2), x)
    End Function
    If your data without labels is in range ($A$2:$C$18), Date_Sel in F2 and Truck in G2 , use =Areas_Served(A2:C18,F2,G2)
    See the file Areas_Served.xlsm
    Last edited by José Augusto; 02-17-2016 at 02:56 PM.

  4. #4
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Listing unique values, based on matching two other columns in a single cell

    you could use pivot table as a option but if you need a formula solution then follow post#3.

    One more formula option requires VBA follow below post
    http://www.excelforum.com/tips-and-t...geravatar.html
    and copy paste the code as suggested in above link and then
    in sheet 2 in C2 copy paste below then hold control and shift together and then hit enter to make it array formula

    =ConcatAll(IF((A2=Sheet1!$A$1:$A$17)*(B2=Sheet1!$B$1:$B$17),Sheet1!$C$1:$C$17,""),",")

    change the ranges according to your data set
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  5. #5
    Registered User
    Join Date
    02-17-2016
    Location
    Syracuse, NY
    MS-Off Ver
    2010
    Posts
    4

    Re: Listing unique values, based on matching two other columns in a single cell

    I made it work ... thank you so much Czeslaw!!!

+ 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: 9
    Last Post: 10-14-2013, 07:55 PM
  2. Listing many unique values based on an if statement
    By MCoev in forum Excel General
    Replies: 6
    Last Post: 01-16-2012, 01:36 PM
  3. VLookup/Listing Matching Values
    By davehedgehog in forum Excel General
    Replies: 2
    Last Post: 10-08-2011, 03:04 AM
  4. Listing values into one cell based on a status...
    By wanton007 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2009, 02:52 AM
  5. Copying a row based on matching unique values
    By timmycl_7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2009, 12:13 PM
  6. Count unique values based on matching criteria
    By gromitw in forum Excel General
    Replies: 9
    Last Post: 01-10-2007, 08:59 AM
  7. [SOLVED] listing values to choose from based on value in another cell
    By MT in forum Excel General
    Replies: 1
    Last Post: 09-12-2005, 09: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