Group by name and count unique values - excel-formula

I have an Excel file like this, where column A and B are given. I want to add column C and D that represent days. D is pretty easy, because it is always one day. C is tricky, because I want to count only "unique" days, where a branch can be one day maximum, where D counts all days.
A B C D
Row Name Branch Unique Overall
1 Jack Health 1 1
2 Jack Health 0 1
3 Jack Food 1 1
4 Jolie Tech 1 1
5 Jolie Food 1 1
6 Jolie Tech 0 1
7 Jolie Health 1 1
I need column C and D for a pivot table like this:
Branch Unique Overall
Health 2 3
Food 2 2
Tech 1 2
I also could add names as a sub position.
Branch Unique Overall
Health 2 3
-Jack 1 2
-Jolie 1 1
Food 2 2
-Jack 1 1
-Jolie 1 1
Tech 1 2
-Jolie 1 2
But that´s something, that can be done after preparing the data and what comes with the program anyway. So how can I design a formula that counts only unique branches for a data set of hundreds of rows?
Thank you!

In C2 put:
=--(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1)
Then copy down

Related

Is it possible to create a formula that would sum multiple columns by looking up two parameters?

The question may sound very odd, so let me explain.
E.g. I have a table that looks like this:
1 2 3 3
Soda 1 2 1 0
Beer 2 0 0 0
Beer 2 1 2 2
Soda 0 2 0 2
I would like to sum each "drink number" for every category, like this:
1 2 3
Soda 1 4 3
Beer 4 1 4
I have used the IFS and SUMIF formula sequence for this (where B$1 = "Column number",$A2 = "Drink name", rest is just columns corresponding to value locations):
=IFS(B$1=“1”,SUMIF($A$2:$A$5,$A2,$B$2:$B$5),B$1=“2”,SUMIF($A$2:$A$5,$A2,$C$2:$C$5),B$1=“3”,sum(SUMIF($A$2:$A$5,$A2,$D$2:$D$5),SUMIF($A$2:$A$5,$A2,$E$2:$E$5)))
But it is very robust, and needs to be changed manually if the initial table is changed.
I would like to make my formula adaptable to changes. Say, it "looks up" row and column values and sums up every column values by them. For example, if one more column "2" is added, and "Beer" is changed to "Milk" (but the "column length" remains the same);
1 2 2 3 3
Soda 1 2 1 1 0
Milk 2 0 1 0 0
Milk 2 1 0 2 2
Soda 0 2 1 0 2
The formula automatically adjusts to this change, and calculate new sum:
1 2 3
Soda 1 6 3
Milk 4 2 4
Is it possible to create such formula? Because I'm not even sure if something like this can be done with basic Excel formulas. Thank you beforehand.
Yes. For example:
=SUMPRODUCT(($A$2:$A$5=$G2)*($B$1:$E$1=H$1),$B$2:$E$5)
where G2 has Soda and H1 has 1. Then copy across and down (assuming Beer in G3 and 2, 3 in I1:J1)

Counting the number of instances a row changes from a specific number to another

Got a bit of a conundrum I've been wracking my brain on for far to long and was wondering if anyone could help.
I have a list of items in column A and columns labelled as weekly periods from B:DA
Item Code
Week 1
Week 2
Week 3
Week 4
Week 5
Week 6
Week 7
Week 8
Results
Item 1
1
1
0
1
0
0
1
0
3
Item 2
1
1
0
0
1
1
1
I need to count the number of times the weekly status goes from 1 to 0 but not from 0 to 1.
In the tabled example I would expect the results to be Item 1 = 3 and Item 2 = 1
Any help pointing me in the right direction would be much appreciated!
Use COUNTIFS():
=COUNTIFS(B2:CZ2,1,C2:DA2,0)
The offset ranges will allow the count of when the prior cell is 1 and the following is 0.

excel multiple criteria and transform horizontaly to verticaly

I have unique number of items and invoices, but one invoice can have multiple items.
A B C D
1 Invoice Items
2 1 10
3 2 20
4 1 30
idea is sort it to horizontaly via this formula
=IFERROR(INDEX($B$2:$B$8;SMALL(IF($D$2=$A$2:$A$8;ROW($A$2:$A$8)-ROW($A$2)+1);COLUMN(A1)));"")
result:
A B C D E F
1 Invoice Items Invoice Item1 Item2
2 1 10 1 10 30
3 2 20
4 1 30
But my geal is setup results horizontaly:
A B
1 Invoice Items
2 1 10
3 1 30
4 2 20
Is that even possible ?
Is your goal actually to sort on Invoice first and then on Items? If so, why just not using sort on two levels using the build in option?
Input:
Sort:
Output:
It's in Dutch but you'll get the idea :)

Tracking work towards awards in MS Excel

I’m trying to create a report from existing data about tasks people have completed and whether they can give given awards for completion of the tasks
I have a list of people who have been working to complete tasks in an exhaustive list, completion of which is recorded in an Excel sheet with ticks or similar characters. (table 1.)
For each of these people, awards can be given when various subsets of these tasks are completed. The tasks required for these awards overlap and are maintained in a list per award. (table 2.)
I would like to generate a report which identifies for each person how many tasks he or she has completed toward each award. I will use this report to identify if they can be given the award or how many more tasks they need to complete.
One way to do it... If you change the tick marks to a numeric value of one (1), you can add formulas to additional columns on the table (or a separate sheet).
| A B C D E F G H I J K L M N
+----+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+----------+----------+----------+
1 | task01 task02 task03 task04 task05 task06 task07 task08 task09 task10 Award 01 Award 02 Award 03
2 | name01 1 1 1 1 1 1 Yes No No
3 | name02 1 1 1 No No No
4 | name03 1 1 1 1 1 1 1 No Yes No
5 | name04 1 1 No No No
6 | name05 1 1 1 1 No No No
7 | name06 1 1 1 No No No
8 | name07 1 1 1 1 1 1 1 1 No Yes Yes
9 | name08 1 1 No No No
10 | name09 1 No No No
11 | name10 1 No No No
The formulas used in L2, M2, and N2:
=IF(SUM(B2:F2)=5,"Yes","No")
=IF(SUM(G2:K2)=5,"Yes","No")
=IF(SUM(C2,F2,I2,J2,K2)=5,"Yes","No")

count data using two columns as references

Is it possible to count or countif by using a column as the data, a cell for the criteria (or what to match) and range of what to count?
Here is what I am looking at:
A1 B C D E F G H I J K L M N O
2 Running Data Total Count of Tardies (by category)
3 Date Employees Leader Start of Shift Break 1 Lunch Break 2 Employees Start of Shift Break 1 Lunch Break 2 Total
4 1-Jul Abe Sue 15 Abe 0
5 3-Jul Steve Bob 20 Anna 0
6 5-Jul Eve Andy 9 20 Eve 0
7 7-Jul Anna Andy 30 Helen 0
8 15-Jul Abe Sue 15 Mark 0
9 18-Jul Anna Andy 10 Steve 0
10 20-Jul Helen Sue 9 0
11 31-Jul Mark Bob 45 0
I am trying to count the data entered on the left (running data) in each category and having it show based on the Employees on the right (in the orange cells). So Abe should show 1 for Start of Shift, Eve should show 1 for Break 1 and Break 2, and Anna should show 2 for Start of Shift.
I have tried using:
=countif(C:C,$J4,D:D) to get the data from JUST Column D for Start of shift, but it gives and error saying too many arguments for the function have been entered.
Help...
...and Thanks!
Countif will only look at 1 column to decide what to count.
Countifs will look at multiple columns. Your formula would look something like this:
=COUNTIFS($C:$C,$J4,E:E,">0")

Resources