How to divide two cells based on match? - excel

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]

Related

Excel - COUNTIF(s) & SUMPRODUCT

I'm trying to count clusters of values in one column but only if a value in another column is above a certain value.
I started with the below code to count how many unique clusters were in a column.
=SUMPRODUCT(1/COUNTIF(B1:B10,B1:B10))
| A | B |
| -------- | -------------- |
| 50 | 1 |
| 200 | 1 |
| 190 | 2 |
| 10 | 5 |
| 100 | 1 |
| 70 | 5 |
| 130 | 2 |
| 10 | 5 |
This would return a value of 3 as there are 3 unique clusters (1,2,5)
However, I am wanting to add a dependacy based on column A. Only count clusters in B if A>100. As there are no values of 5 in column B where A>100, the cluster count in B would be 2.
Any help to achieve the above would be very much appreciated!!
For any version:
=COUNT(1/(FREQUENCY(IF(A1:A8>100,B1:B8),B1:B8)))
array entered (with Ctrl+Shift+Enter) if non-365. If you have 365 use JvdV's answer. :)
With Microsoft365:
=COUNT(UNIQUE(FILTER(B1:B8,A1:A8>100,"")))
With older versions:
=SUMPRODUCT((A1:A8>100)*IFERROR(1/COUNTIFS(A1:A8,">100",B1:B8,B1:B8),0))

excel: filter using formulas

I have a list of people who belong to two groups (A or B). I want to create a column which lists all the people who belong to group A.
I have been trying to come up with an array formula but I do not have a working example. Any help appreciated!
Names | Group | Desired Output
Bob | A | Bob
Fred | B | Eric
Matt | B | Dave
Eric | A | Fred
Dave | A |
Stew | B |
Fred | A |
Many Thanks in advance
Normal formula for column C:
C2=
=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(B:B)/(B:B="A"),ROW()-1)), "")
Copy/paste down in column C for a sufficient number of cells.
Array formula: select a sufficient number of cells in column C and write the same formula in the formula bar then press Ctrl+Shift+Enter
From this
+---+-------+-------+
| | A | B |
+---+-------+-------+
| 1 | Name | Group |
| 2 | Nick | A |
| 3 | Marc | A |
| 4 | Manny | B |
| 5 | Luck | A |
+---+-------+-------+
you can create two pivot tables with Name in the row label and Group in the filter data.
Then you can filter only people depending on the group.
+---+-------------------+---+
| | A | B |
+---+-------------------+---+
| 1 | Group | A |
| 2 | | |
| 3 | Etichette di riga | |
| 4 | Luck | |
| 5 | Marc | |
| 6 | Nick | |
+---+-------------------+---+
So if your data is in range A1:B7 this would be the formula:
=IFERROR(INDEX($A$1:$A$7,SMALL(IF($B$1:$B$7="A",ROW($A$1:$A$7)-ROW($A$1)+1),ROWS($A$1:A1))),"")
This is array formula that is applied with Ctrl + Shift + Enter and you will need to drag it down.

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.

Ordering the third column in excel according to first column (and fill blanks)

I have three columns, two first columns have identical values, the third one has some values missing (below nr. 2 & 4 are missing).
So how can I "order" these:
+---+---+---+
| A | B | C |
+---+---+---+
| 1 | 1 | 1 |
| 2 | 2 | 3 |
| 3 | 3 | 5 |
| 4 | 4 | |
| 5 | 5 | |
+---+---+---+
To become:
+---+---+---+
| A | B | C |
+---+---+---+
| 1 | 1 | 1 |
| 2 | 2 | 0 |
| 3 | 3 | 3 |
| 4 | 4 | 0 |
| 5 | 5 | 5 |
+---+---+---+
As you can see, the values that are missing are being (i.e. should be) filled with zero.
The numbers above are unique (i.e. I can't have two 4's in the same column). So how can I get the same values from Column C to be right next to column B (and then I can fill the empty fields with zero).
Assuming you have row 1 as headers...
Create a new column D with the formula in D2=
=IFERROR(VLOOKUP(A2,C:C,1,FALSE),0)
drag down and then copy/paste special values columns D and delete column C

Kind of group by in Excel without VBA

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.

Resources