Combine data from different rows matching multiple criteria into one row

pr1ncess426

New Member
Joined
Sep 18, 2016
Messages
14
I have a large amount of data that represents colors at different time points for specific identifiers (a, b, c, and so on...). The identifiers are listed with their corresponding color/time point, however if a single identifier has multiple colors (and therefore time points) assigned to it then that identifier is listed several times (each new color/time point combo gives populates as a new row assigned to that identifier).

I need to create a cleaned up spreadsheet where each identifier is only listed once (one row per identifier) with the columns next to it containing all of the corresponding color and time point data on that same row.

I would like the final product to look something like this:

1:00PM 2:00PM 3:00PM
a yellow purple
b red
c black violet pink
d orange green


Due to the specifics of my project, I need to clean up the data using only an excel formula that will update automatically even as my "given data" input changes. I'm also trying to avoid using helper columns or clunky formulas as much as possible, as my original data set is rather large. Any suggestions?

Screen Shot 2020-03-17 at 8.05.27 PM.png
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi Pr1ncess426,

I think this does what you ask.

Pr1ncess426.xlsx
BCDEFGHIJ
1GIVEN DATACLEANED UP DATA
2
31:002:003:001:002:003:00
4apurpleayellow purple
5ayellowbred  
6bredcblackvioletpink
7cvioletdorange green
8cblacke whitebrown
9cpinkf grey 
10dorange
11dgreen
12ewhite
13ebrown
14fgrey
WithOffset
Cell Formulas
RangeFormula
G4:G9G4=INDEX($B$4:$B$14,MATCH(0,INDEX(COUNTIF($G$3:$G3,$B$4:$B$14),),0))&""
H4:J9H4=IFERROR(INDEX(C$4:C$14,AGGREGATE(15,6,ROW($B$4:$B$14)-ROW($B$3)/((C$4:C$14<>"")*($B$4:$B$14=$G4)),1)),"")
 
Upvote 0
Thank you, Toadstool! This is exactly what I am hoping to do.

I was able to get the G4 formula to work with my original data set, however I am having trouble applying the H4 formula. When I change the identifiers (a,b,c) to match my original data (which is numbers), the formula that outputs the matching colors no longer works.

Any suggestions as to why this might be?
 
Upvote 0
Can you confirm some details about the worksheet you're putting together? You're able to construct the list of unique values that are in column B?...and that unique list is being built in column G?
And then the table of GIVEN DATA has column headers in row 3?...and the data begin on row 4?
Could you paste the formula you're using that corresponds to the H4 formula in @Toadstool's solution? I'm wondering if there is a mismatch in column or row specifiers.
 
Upvote 0
Hi Pr1nces426,

Yes, the G column formula has &"" at the end because you showed the key as characters. To change to numeric just remove the &"" so the comparison works.

Pr1ncess426.xlsx
BCDEFGHIJ
1GIVEN DATACLEANED UP DATA
2
31:002:003:001:002:003:00
41purple1yellow purple
51yellow2red  
62red3blackvioletpink
73violet4orange green
83black5 whitebrown
93pink6 grey 
104orange
114green
125white
135brown
146grey
Numbers
Cell Formulas
RangeFormula
G4:G9G4=INDEX($B$4:$B$14,MATCH(0,INDEX(COUNTIF($G$3:$G3,$B$4:$B$14),),0))
H4:J9H4=IFERROR(INDEX(C$4:C$14,AGGREGATE(15,6,ROW($B$4:$B$14)-ROW($B$3)/((C$4:C$14<>"")*($B$4:$B$14=$G4)),1)),"")
 
Upvote 0
The worksheet I am building will be much larger with the identifiers occupying approximately cells A3:A1000. The built list of unique identifiers will begin in AB3. This formula (G4 from your previous example) works well with my data.

The GIVEN DATA has column headers in row 2, and the data begins in row 3. I was also concerned there might be a mismatch in the column or row specifiers, but when I looked through your formula and compared it to mine everything checked out.

The issue I am having is when I go to change the identifiers from the letters I gave in my example (a, a, b, c, c, c..), to my original data, which happens to be numerical, the H4 formula no longer populates the colors. It seems that I can change the identifiers to any string of letters, but if I try to put numbers there the formula stops working:

Screen Shot 2020-03-19 at 2.36.07 PM.png
 
Upvote 0
For some reason when I plug my original data into the H4 formula, only the FIRST color instance is showing up for each unique identifier in the Cleaned Up Data area. Any suggestions? Could this have anything to do with the fact that my original data is actually numerical as well? (Sorry - just realizing I should have provided an example with all numerical data since this is what I am actually working with. Won't make that mistake again!)
 
Upvote 0
I notice that your unique list of numbers is left justified...are they actually formatted as text?
 
Upvote 0
I'm not sure why they were showing up left justified in the screenshot I sent you. I just checked again and they are right justified now. I set the formatting of that column to "general" just to be sure.
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top