Display all matching values in one comma separated cell - excel

I have two columns of data in an Excel 2010 spreadsheet. In Column A is a category, and in Column B is a value. There will be multiple values in Column B for each unique category in Column A.
What I want to achieve in a separate sheet is to display all of the values for each each unique category in one comma (or semi-colon etc) separated cell.
For example, if my first sheet looks like this:
----------------------
| Category | Value |
----------------------
| Cat1 | Val A |
| Cat1 | Val B |
| Cat1 | Val C |
| Cat2 | Val D |
| Cat3 | Val E |
| Cat3 | Val F |
| Cat3 | Val G |
| Cat3 | Val H |
----------------------
I'd want to display the following in another sheet:
---------------------------------------
| Category | Value |
---------------------------------------
| Cat1 | Val A,Val B,Val C |
| Cat2 | Val D |
| Cat3 | Val E,Val F,Val G, Val H |
---------------------------------------
Can this be achieved with a formula? Vlookup will only find the first matching value, of course. I've Googled it, but the individual search terms involved in the query are so generic I'm getting swamped with inappropriate results.

Please try (in a copy on another sheet):
Insert a column on the left with =IF(B2<>B3,"","x") in A2 (assuming Category is in B1). In D2 put =IF(B1=B2,D1&", "&C2,C2) and copy both formulae down to suit. Copy and Paste Special Values over the top. Filter on ColumnA for x and delete selected rows. Unfilter and delete ColumnA.

Related

Combining rows of a table using similar cells of one of its columns in Excel

I have a table (1) in Excel, with two columns, in which at the first column (A) there are some numbers and at the second column (B) there are some letters. I want to have a method to make another table (2) from (1) to put different letters at the first column then to put in each row the numbers that were corresponded to letters in table (1).
For example, let the table (1) is:
| A | B |
|---|---|
| 1 | a |
| 1 | b |
| 2 | a |
| 2 | c |
| 3 | b |
| 4 | b |
What is a method in Excel which make the following combination table:
| a | 1 | 2 | |
| b | 1 | 3 | 4 |
| c | 2 | | |
in which letters are in first column and in each row there are the numbers that were in relationship with the row's letter in table (1)?
As per below screenshot use below formula to C1 cell.
=UNIQUE(B1:B6)
And following formula to D2 cell then drag down
=TRANSPOSE(UNIQUE(FILTER($A$1:$A$6,$B$1:$B$6=C1)))

Excel Macro to find a cell based on matching two values (Row/Column) and replace value in cell

I am having some trouble trying to find a solution to an issue I have. I have two excel sheets that I would like to find or index values from one sheet to the other and then replace the value of the cell after locating the cell.
I think maybe a better way to picture is that I have a excel sheet "Data1" that consists of three columns with rows of data.
Example of Sheet 1:
A B c
1 | Header 1 | Header 2 | Header 3 |
2 | -------- | -------------- |----------|
3 | 123456 | AABB |12AB12AB |
4 | 678910 | BBCC |34CD34CD |
I have a second Excel Sheet "Data2" that consists of multiple columns and rows of data.
Example Sheet "Data2":
A B C D E
1 | Header1 | BBCC | CCDD | AABB | EEFF |
2 | -------- | -----------|----------|---------|---------|
3 | 123456 | ValueX | ValueY | ValueZ | ValueB |
4 | 678910 | ValueXX | ValueXY | ValueYY | ValueZZ |
What I would like to do is run a macro:
To first, match the value A3 (123456) in Sheet "Data1" to the same value in Column A from Sheet "Data2"
Second, match the value B3 (AABB) in Sheet "Data1" to the same value in Row 1 from Sheet "Data2"
Third, replace the value in the corresponding cell with the value from Sheet "Data1" cell C3.
Then, Loop and replace all cells until the rows of data from Sheet "Data1" end.
The Values in Sheet "Data2" should then change to look like:
A B C D E
1 | Header1 | BBCC | CCDD | AABB | EEFF |
2 | -------- | -----------|----------|----------|---------|
3 | 123456 | ValueX | ValueY | 12AB12AB | ValueB |
4 | 678910 | 34CD34CD | ValueXY | ValueYY | ValueZZ |
Please let me know what you think and I hope I laid out the requirements as simple as possible. Thank you for your time and support to help me work this solution. Cheers
IF your version of Excel supports XLOOKUP then you can set up Sheet "Data3" with the same column and row headers and use this functions for the data cells.
=XLOOKUP($A3&B$1,Data1!$A$3:$A$4&Data1!$B$3:$B$4,Data1!$C$3:$C$4,Data2!B3)
It takes the data in data2 and overwrites it with the data from data1 if there is a match.
More on XLOOKUP

Excel: get the value of third column on the behalf of second column

i am not much familiar with excel formulas and i am trying to get the value of third column on the behalf of second column.
Example:
|---------------------------------------------------------|
| A B C D E |
|-----|----------|----------|--------------|--------------|
|Sr.No| Bar Code | Cat Id | Org BarCode | Org Category |
|---------------------------------------------------------|
| 1 | 89457898 | | 85214784 | 2 |
| 2 | 87414714 | | 63247458 | 3 |
| 3 | 85214784 | | 89457898 | 4 |
| 4 | 63247458 | | ---- | --- |
-----------------------------------------------------------
i just want to update column C by column E on the behalf of column D and B
can any one please tell me the formula, how i can do this?
Use VLOOKUP. Enter the following formula into cell C1 and then copy it down the C column:
=VLOOKUP(B1, D$1:E$4, 2, FALSE)
To cover more than 4 rows, then just update the formula accordingly. If you want to display a certain placeholder value if a value in column B be not found, then you wrap the call to VLOOKUP as follows:
=IFNA(VLOOKUP(B1, D$1:E$4, 2, FALSE), "Not found")

Match a Path Vlookup

I have tow table which looks like this:
Table B:
+-----------+--------------------+----------+
| DocNumber | URL | Type |
+-----------+--------------------+----------+
| HTZ12 | http://google.com | URL |
| HT45 | www.halloworld.com | Car |
| ZT1245 | Test | Building |
+-----------+--------------------+----------+
Table A:
+-----------+------------------+
| DocNumber | URL |
+-----------+------------------+
| HTZ12 | http://google. |
| HT45 | www.halloworld.c |
| ZT1245 | Test |
+-----------+------------------+
Both tables are in the same excel sheet I would like to do a vlookup from tabel A to B via the DocNuber and get the Type from Tabel B
=VLOOKUP(J2;Old_Internal_library!A:L;1;0)
in J2 is the DocNumber from Tabel A
That is image of tabel A (going via Document Number J)
Table B where I want to get the Turbocharger Type in column D
Your current code is looking up the data in the leftmost column in your range of Old_Internal_library!A:L and returning the data in the first column in the range. The 1 in your formula represents which column (relative to your range) you are returning data from.
So for example, if you are looking up the 'Type', which looks to be in the 3rd column in your range, you will need to change your formula to:
=VLOOKUP(J2;Old_Internal_library!A:L;3;0)
EDIT:
As the lookup value is in Column E of Table B and the value you'd like to return is in Column D you will need to use an INDEX/MATCH function. Try:
=INDEX(Old_Internal_library!D:D;MATCH(J2;Old_Internal_library!E:E;0))

SUM of multiple VLOOKUP

It seems like a simple problem, but I do not manage to solve it. I have the following tables:
Values
| Key | Value |
|-----|-------|
| A | 1 |
| B | 2 |
| C | 3 |
Results
| Foo | Bar |
|-----|-----|
| A | B |
| C | B |
| A | A |
| B | C |
| ... | ... |
What I am looking for is a final row in the Results table that looks for the key in the Values table, takes its value and sums all the keys in a column (i.e. FOO and BAR). The final result would be:
| Foo | Bar |
|-----|-----|
| A | B |
| C | B |
| A | A |
| B | C |
|-----|-----|
| 7 | 8 |
I have been trying with different VLOOKUP, INDEX and MATCH functions, but still I am not able. Any ideas?
I asume you want a solution without extra columns. Then you are into Array formulas (a.k.a CSE or ControlShiftEnter functions).
Combination of {=SUM(VLOOKUP(...))} doesn't work, but combination of {=SUM(SUMIF(...))} does:
in A12 enter =SUM(SUMIF($A$1:$A$3;A7:A10;$B$1:$B$3)) and save with Ctrl+Shift+Enter. You then can copy this to B12.
Problem is you will need to change the Array function every time you add values to the list A7:B10 (or you initially make the range sufficiently large) ... this would speak more for extra =VLOOKUP() columns as suggested by CustomX.
I'm not sure of other solutions, but you could solve this by using an extra 2 columns, E and F for example.
Enter this in column E: =VLOOKUP(C2;$A$1:$B$3;2;0)
Enter this in column F: =VLOOKUP(D2;$A$1:$B$3;2;0)
Pull the formulas down and add a SUM at the bottom of column C and D to calculate columns E and F.
Extra: These are the columns I used for your examples.
Key = column A
Value = column B
Foo = column C
Bar = column D

Resources