How to count unique values w.r.t one column in excel? - excel

I am trying to find the number of unique values in column B("Levels") for each value in column A("Heads").
For example for Heads "A" we have 3 unique values ("ALPHA", "BETA", "ECHO") and it should return in column "Expected Count".
Heads Levels Expected Count
A ALPHA 3
A ALPHA 3
A BETA 3
A ECHO 3
B CHARLIE 2
B CHARLIE 2
B DELTA 2
C ALPHA 4
C BETA 4
C CHARLIE 4
C DELTA 4
I need to execute the functionality for 1000's of rows. Is there any formula?

you need one new column. insert it between B and C. concatenate column a and b with formula
=a&b
then do a simple formula in column d and drag that down on your 1000's of rows
=countifs(C:C,C2)

Related

Excel Data convert from single row to multiple row

I have data in excel in following manner.
Colname Count
A 5
B 3
C 4
I want to convert it into this way.
A 1
A 2
A 3
A 4
A 5
B 1
B 2
B 3
C 1
C 2
C 3
C 4
Based on the count i want that data must be converted into rows with increasing order. Please let me know the feasiblity .
=IF(ROW()<B$1+1,"A",IF(AND(ROW()>B$1,ROW()<SUM(B$1:B$2)+1),"B",IF(AND(ROW()>SUM(B$1:B$2),ROW()<SUM(B$1:B$3)+1),"C",""))) in F1 and fill down. In G1, this formula =IF(COUNTA(F1)>0,COUNTIF(F$1:F1,F1),"") and fill down. Letters are in Column A and numbers in Column B. I chose these columns randomly to work a solution. Change to match your actual data, if needed.

Rank like Subtotals

It's possible use Rank like Subtotals, that only use de showing data?.
If I filter data by a column, I want than Rank function only use these datas
Example
A B C The column C its Rank of column B
a 5 3
b 9 1
a 2 4
c 7 2
Now if I apply a filter in column A for value 'a'
A B C I want the rank recalculate with this new data
a 5 1 --> column C change from value 3 to value 1
a 2 2 --> column C change from value 4 to value 2
Thanks
You cannot do it by using RANK() formula, but you can create customizable rank formula. For this, You should add column at the and of table to indicate the row visibility, and put this formula into this column:
=(AGGREGATE(3;5;B2)>0)+0
Then put this formula into column C:
=SUMPRODUCT(($B$2:$B$9<B2)*($E$2:$E$9=1))+1
To check real example, download my sample file

Match value based on criteria in two columns

I have the following values in columns A, B and C.
A B C D
3 3 5
4 4 10
In cell D1, how can I find the value in Column C where A=A+1 and B=B+1 i.e. 10?
Are you looking for something like below?
=VLOOKUP(SUM(A1+1,B1+1),C:C,1,FALSE)

Look up for highest value from another column if values are equal excel

***1 2 3***
a 2 3
b 3 4
c 4 3
d 5 2
so I know to get the highest value I do
=INDEX(column1, MATCH(MAX(column3), column3, 0))
... which would give me 'b'
now I want to get the second highest value based on the column 3 but because there are two cells with 3 (which is the second highest value) I want to use the one that has the lowest value in column 2 based on those two rows. Is this possible?
Use a 'helper' column that adds column C + (column B ÷ 10) and use a modification of your original formula on that column.
        
The standard formula in F5 is,
=INDEX(A$2:A$5, MATCH(AGGREGATE(14, 6, D$2:D$5, ROW(1:1)), D$2:D$5, 0))
Fill down as necessary.

Merge unique values if another cell matches

Merge all unique values if another cell matches. I already know how to merge cells but now some information is double. So what I would like to achieve is the following:
if column A has the same name, then all values given in column B for
that name must be given only ONCE in a new column.
My data has a row names and a row mode, for example (Row 1 is header)
A B
2 Brenda a
3 Brenda a
4 Joey a
5 Joey b
So I want:
E
2 a
3
4 a,b
5
I already did merge the modes in column 3:
=IF(A1<>A2;B2;C1&","&B2)
So I get in this example:
C
2 a
3 a,a
4 a
5 a,b
Then, I already did that only the first record get the additional modes in column 4:
=IF(A1=A2;"";INDEX(Sheet1!$C:$C;COUNTIF(Sheet1!$A:$A;$A2)+MATCH($A2;Sheet1!$A:$A;0) -1))
So I get in this example
D
2 a,a
3
4 a,b
5
Now I need a column that only uniques values are given for each name. So in this example:
E
2 a
3
4 a,b
5
If I am understanding how your data is structured, try this:
Add a new column, say column G for ease of explanation, that concatenates the name and mode in each row. So, cell G2="Brendaa", G3="Brendaa", G4="Joeya", G5="Joeyb", etc.
In your merge step you will test whether the current value in the cell for this column matches any previous values in the column: If no, you do the merge; if yes, you don't.
Your merge formula would change to something like the following:
=IF(A1<>A2,B2,IF(ISERROR(VLOOKUP(G2,G$1:G1,1,0)),C1&","&B2,""))
Then you would the next step as before.

Resources