How to get information from several cells into one cell

RedAppl3

New Member
Joined
Mar 6, 2018
Messages
4
Hi guys,

Made an account here because i have been trying to figuring this out for hours now to no prevail. Maybe you guys can find a solution.
I have a table with several thousand article numbers, and i want to create a new table where all the sizes for the same article number are gathered up.

Is this even possible?


My table:

Article numberSize

<tbody>
</tbody>
011.0400

<tbody>
</tbody>
8
011.0755

<tbody>
</tbody>
9
011.245

<tbody>
</tbody>
L
011.245

<tbody>
</tbody>
M
011.624

<tbody>
</tbody>
9
012.422U

<tbody>
</tbody>
10
012.422U

<tbody>
</tbody>
11
012.422U9

<tbody>
</tbody>

Wanted Outcome:

Article NumberAll Sizes
011.0400

<tbody>
</tbody>
8
011.0755

<tbody>
</tbody>
9
011.245

<tbody>
</tbody>
L, M

<tbody>
</tbody>
011.624

<tbody>
</tbody>
9

<tbody>
</tbody>
012.422U

<tbody>
</tbody>
10, 11, 9

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi and welcome to the forum. Some questions:

1. Which version of Excel do you have and is it Windows or Mac?
2. Do you want this only using formulas or is VBA acceptable?
3. On the new table, do you already have the list of unique article numbers or do you want that generating also?

WBD
 
Upvote 0
Good questions by wideboydixon. The easiest way is just to make a pivot table out of your data. Then you can just add Article Number and Size fields to the pivot table Rows.

I made a custom function if that interests you. I took your Article numbers, copied them to a new column, and then removed duplicates. Then, in the next column, I have the custom function which has 2 arguments. 1st argument is the cell that you are looking at, i.e. the first cell in the column with the duplicates removed. 2nd argument, your entire table with article numbers and sizes. Here's the code.

Code:
Function Combine(s As String, r As Range) As String
Dim cel As Range
Dim AR()
Dim res As String


AR = r.Value


For i = 1 To UBound(AR)
    If AR(i, 1) = s Then
        res = res & AR(i, 2) & ", "
    End If
Next i


res = Left(res, Len(res) - 2)
Combine = res
End Function

And your formula would look like this...

Code:
=Combine(F2,$A$2:$B$9)

Like wideboydixon is alluding to, you could automate some of the processes going on here with VBA and basically do everything in one fell swoop.
 
Upvote 0
Hi and welcome to the forum. Some questions:

1. Which version of Excel do you have and is it Windows or Mac?
2. Do you want this only using formulas or is VBA acceptable?
3. On the new table, do you already have the list of unique article numbers or do you want that generating also?

WBD


Hi,

1. Im using the 2016 version on Windows

2. Formulas would be prefered as i don't really know what VBA is. I am only a few months in to learning excel, but i will read up on this.

3. I already have the list of unique article numbers :)

Thanks :)
 
Upvote 0
Hi there

This is a bit of a clunky solution but I hope it gets you on your way. I am assuming your table starts at A1.

Put this formula in C2 and copy down: =IF(ISNA(VLOOKUP(A2,A3:A$9999,1,FALSE)),B2,VLOOKUP(A2,A3:C$9999,3,FALSE)&","&B2) (9999 is any row number after the last row of data)

Set up a list of unique article numbers in column F with the first value in row 2 - one way is to copy all column A values into column F (or anywhere really) and use the remove duplicates function.

Put the following formula in G2: =VLOOKUP(F2,A$2:C$9999,3,FALSE) and copy down.

Obviously, if the list of articles changes, you will need to rebuild the list of unique values.
 
Upvote 0
Welcome to the MrExcel board!
1. Im using the 2016 version on Windows
I'm assuming that is the 2016 version through Office 365 as that has the TEXTJOIN function I have used below.

This is an array formula so should be entered without the {} but, after adjusting the ranges to suit your larger data, confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Excel Workbook
ABCDEF
1Article numberSizeArticle numberSizes
211.04811.048
311.0755911.07559
411.245L11.245L, M
511.245M11.6249
611.6249012.422U10, 11, 9
7012.422U10
8012.422U11
9012.422U9
10
Combine Values 1
 
Last edited:
Upvote 0
Hi there

This is a bit of a clunky solution but I hope it gets you on your way. I am assuming your table starts at A1.

Put this formula in C2 and copy down: =IF(ISNA(VLOOKUP(A2,A3:A$9999,1,FALSE)),B2,VLOOKUP(A2,A3:C$9999,3,FALSE)&","&B2) (9999 is any row number after the last row of data)

Set up a list of unique article numbers in column F with the first value in row 2 - one way is to copy all column A values into column F (or anywhere really) and use the remove duplicates function.

Put the following formula in G2: =VLOOKUP(F2,A$2:C$9999,3,FALSE) and copy down.

Obviously, if the list of articles changes, you will need to rebuild the list of unique values.


This is amazing! Worked like a charm.


Thank you everyone for the help! I will be looking more at all the respones and different solutions when i come home from work just so i can learn! :)
 
Upvote 0

Forum statistics

Threads
1,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

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