Kind of group by in Excel without VBA - excel

I need another transformation help in Excel
| A | B |
---| ----|--------|
1 | ID | Course |
2 | 1 | A1 |
3 | 1 | A2 |
4 | 2 | A1 |
5 | 3 | A2 |
I want to have a kind of group by, i.e.
| A | B | C |D | ...
---| ----|---------|---------|---------|----
1 | ID | Course1 | Course2 | Course3 | ...
2 | 1 | A1 | A2 | | ...
3 | 2 | A1 | | | ...
4 | 3 | A2 | | | ...
Any ideas? Is it possible without VBA macro?

I believe that the following link on removing duplicates from column would suit your needs (in your case you would do it horizontally).
http://www.get-digital-help.com/2009/03/30/how-to-extract-a-unique-list-and-the-duplicates-in-excel-from-one-column/

Per your reply to Robert, if you want to do it without VBA, try this... Select all cells in the first column. Copy and paste them into the first column of another worksheet. Use Excel's Remove Duplicates function on the pasted data. Then use INDEX functions in the columns to the right in order to pull the first, second, etc values matching that first column value.

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)))

How to divide two cells based on match?

In a table 1, I have,
+---+---+----+
| | A | B |
+---+---+----+
| 1 | A | 30 |
| 2 | B | 20 |
| 3 | C | 15 |
+---+---+----+
On table 2, I have
+---+---+---+----+
| | A | B | C |
+---+---+---+----+
| 1 | A | 2 | 15 |
| 2 | A | 5 | 6 |
| 3 | B | 4 | 5 |
+---+---+---+----+
I want the number in second column to divide the number in table 1, based on match, and the result in third column.
The number present in the bracket is the result needed. What is the formula that I must apply in third column in table 2?
Please help me on this.
Thanks in advance
You can use a vlookup() formula to go get the dividend. (assuming table 1 is on Sheet1 and table 2 in Sheet2 where we are doing this formula):
=VLOOKUP(A1,Sheet1!A:B, 2, FALSE)/Sheet2!B1
Since you mention table, with structured references, though it seems you are not applying those here:
=VLOOKUP([#Column1],Table1[#All],2,0)/[#Column2]

Getting Summation from a Table, with matching values from another Table in Excel

I have 2 tables created in Excel, which are identical in structure and the column and row names.
The only difference is that the first table has data (for the effort in work days) in it while the second is a reference table stating which milestone each cell belongs to. A sample of these tables is:
TBL1:
| | App1 | App2 | App3 |
| T1 | 32 | 12 | 48 |
| T2 | 40 | 16 | 30 |
| T3 | 56 | 18 | 36 |
TBL2:
| | App1 | App2 | App3 |
| T1 | 1 | 2 | 3 |
| T2 | 2 | 1 | 2 |
| T3 | 1 | 1 | 1 |
I want to collate these values so that I get SUM of 1, 2 and 3
| | Days Summation |
| 1 | =32+56+16+18+36 |
| 2 | =40+12+30 |
| 3 | =48 |
So basically, want to find:
IF(COL_VAL_IN_TBL2=1) THEN SUM ALL VALUES IN TBL1 CORRESPONDING TO THE ROW-COL IN RESPECTIVE
Is it possible to get a formula which I can use to do this without using something like a Pivot Table?
You can use sumif() to do this:
Here it's just looking at table2 values and comparing them to your 1, 2, or 3 and then summing the corresponding cells from your table1
SUMIF will do the trick if I understand correctly:
If you put 1 in A1, then 2 in A2, etc. Then enter in B1=SUMIF(TBL2Range,A1,TBL1Range) and copy down. Where TBL2Range is the address of your table.

Create Distinct ID by Group in Excel without sorting

I have an Excel column that cannot be sorted and for which I need to create a unique id by group, similar to what is below:
+--------+------+
| Name | ID |
+--------+------+
| Jim | 1 |
| Sarah | 1 |
| Tim | 1 |
| Jim | 2 |
| Rachel | 1 |
| Sarah | 2 |
| Jim | 3 |
| Sarah | 3 |
| Rachel | 2 |
| Tim | 2 |
+--------+------+
You can do this with a simple COUNTIF() and getting a little creative with your cell references:
=COUNTIF($A$1:$A1, A2) + 1
Put that in B2 (assuming your list with headers starts in A1) and then copy down.
COUNTIF() here is counting the number of times the name in the adjacent cell has appears in all of the cells above it. As you copy it down, that range will grow to include all cells between A1 and the next row up.

In Excel, How do I count the number of blank cells until the next non-blank cell

I have a spreadsheet which resembles the below. Column A is my data and Column B is what I am trying to achieve
A B
+-----------+-----------+
1 | Some text | A1:A3 |
+-----------+-----------+
2 | | |
+-----------+-----------+
3 | | |
+-----------+-----------+
4 | Some text | A4:A8 |
+-----------+-----------+
5 | | |
+-----------+-----------+
6 | | |
+-----------+-----------+
7 | | |
+-----------+-----------+
8 | | |
+-----------+-----------+
9 | Some text | A9:A9 |
+-----------+-----------+
10 | Some text | A10:A10 |
+-----------+-----------+
11 | | |
+-----------+-----------+
12 | | |
+-----------+-----------+
As you can see, Column A just contains empty and non-empty cells (all cells, including empty ones, actually contain a formula). In column B, I need to return a range starting at the current row and ending at the first non-empty row, but only if Column A of the current row is not blank. The returned result is to be used within another function. For example B1 could be COUNTBLANK(A1:A3), although the actual function is not COUNTBLANK, but a custom function
Is this possible?
Thanks
Please add a letter at the bottom of your "occupied" ColumnA then try, in B1 and copied down:
=IF(A1="","","A"&ROW()&":A"&ROW()+MATCH("*",A2:A100,0)-1)
Alternative to account for restriction mentioned by OP
=IFERROR(IF(A1="","","A"&ROW()&":A"&ROW()+MATCH("*",A2:A$1048576,0)-1),"A"&ROW()&":A"&ROW())

Resources