Show top 3 from list based on difference - excel

I have 2 lists;
"yesterday" and "today".
As rows I have a list of companies and the data shown is customer satisfaction going from 0-10. I want to show the top 3 companies that has the best difference between "yesterday" and "today".
How would you approach this??
Expected output looking for top 1:
Yesterday - Today
Company A: 5 10
Company B: 7 8
Company C: 8 6
Top 1: Company A (Since they moved the most(5 positive points))

Assuming your data is like this:
#########Sheet1<YESTERDAY>########
| A | B |
1|Companies| Customer satisfaction|
2|Company1 | 6
3|Company2 | 3
4|Company3 | 4
5|Company4 | 1
6|Company5 | 9
###########Sheet2<TODAY>##########
| A | B | C | D |
1|Companies| Customer satisfaction|Absolute changes | RANK |
2|Company1 | 1 | | |
3|Company2 | 7 | | |
4|Company3 | 7 | | |
5|Company4 | 4 | | |
6|Company5 | 8 | | |
Put this formula into Cell C2to get absolute change:
=ABS(VLOOKUP(A2,YESTERDAY!$A$2:$B$6,2,FALSE)-B2)
Put this formula into Cell D2to get Rank:
=RANK(C2,$C$2:$C$6,0)
So, 1,2,3 in Column RANK are best changes.

I assume best difference as highest difference.run a loop and take the first row company from yesterday as well as the customer satisfaction value and search that same company in today in another inner loop and find the difference of the two values and save it in an array.After that sort the array and display the top 3.

Related

Using IF AND to calculate based on one or more criteria

Within a resource planner, my data has a row for each employee, and columns detailing the team they work for. Another column details the available days they will work in the year. The teams are also displayed along a row at the top, see below :
A | B | C | D | E | F | G |
1 Employee | Team 1 | Team 2 | Days | Finance | Risk | IT |
2 Employee 1 | Finance | | 170 | | | |
3 Employee 2 | Risk | Finance | 170 | | | |
4 Employee 3 | Finance | | 170 | | | |
5 Employee 4 | IT | Risk | 170 | | | |
6 Employee 5 | IT | Finance | 170 | | | |
I want to use columns E:G as a supply calculator per team. Therefore, the formula in cell E2 would be "=IF(B2=E1,D2,0)" and copied along the row, returning the 170 days under Finance and 0 under the rest.
The issue lies where an employee divides his time between two different teams. As you can see, some employees can work for 2 different teams (Employee 2 works for both Finance and Risk, for example). The formula in E3 would therefore need to be some kind of IF AND, where if a value is present in the Team 2 column (C), the value in the Days column (D) would be divided by two and split across the relevent team columns.
I've tried a few options, IF AND, nested IFS etc but cant seem to get the syntax correct. Any help greatly appreciated.
=IF(ISNUMBER(MATCH(E$1,$B2:$C2,0)),$D2/COUNTA($B2:$C2),0)
You actually want OR and COUNTA:
=IF(OR($B2=E$1,$C2=E$1),$D2/COUNTA($B2:$C2),0)

Spreadsheet Formula to Sum Values Over A if B is not in a List of Values

I have a table that looks the following:
| A | B | C |
| 40 | 1 | 1 |
| 180 | 2 | 2 |
| 34 | 1 |
| 2345 | 3 |
| 23 | 1 |
| 1 | 2 |
| 4354 | 3 |
| 2 | 2 |
| 343 | 4 |
| 2 | 2 |
| 45 | 1 |
| 23 | 1 |
| 4556 | 3 |
I want to get the sum of all fields in A where B is neither 1 nor 2 or any other value from colum C. This column contains the values of B where values from A should not be considered for the sum.
I do not know which values B might contain, those values are random and could grow larger, I just wanted to make the example small. My current solution is
{=SUMIF(B1:B13,C1:C2,A1:A13)}
so i can set the lines that should be excluded from the sum in column C. Unfortunately, the current solution does not solve my problem but something different -- it sums up the corresponding entries by value in C. My preferred solution would look something like
=SUMIF(B1:B13,"<>{1, 2}",A1:A13)
=SUMIF(B1:B13,"<>"&C1:C2,A1:A13)
if that were possible (it isn't). I would like to have:
a field (with a list, for example) or column where i can put in the values of B that I do not want to be part of the sum over A.
a method that works with Open Office as well as Excel. I prefer an OO solution.
You could use an array formula so that you can multiply each value in A with a condition. That condition can be any valid Excel formula, so, for instance, you could use MATCH to test if the B value occurs in C:
=SUM((A1:A13)*ISNA(MATCH(B1:B13,$C:$C,0)))
The ISNA function returns TRUE when the match fails, which in a multiplication is used as a numerical value 1. FALSE will make the product 0.
Make sure to enter this as an array formula with Ctrl+Shift+Enter

Get unique values from matrix

I have a Matrix and want unique values from this matrix (see picture below)
The matrix is a top 20 pr week, but I want a list of all that during the past year have made it to the "weekly top 20 list".
=INDIRECT(TEXT(MIN(IF(($A$1:$E$11<>"")*(COUNTIF($G$1:G1,$A$1:$E$11)=0),ROW($1:$11)*100+COLUMN($A:$E),7^8)),"R0C00"),)&""
place that off in some cell to the right and adjust your address ranges. With out knowing your column headers and row numbers I cant make the adjustments for you. $G1:G has to be an empty cell above the column just above the start of the column you are generating of unique name...actually it maybe ok to be a filled with text that is not in your matrix, but I have not tested that.
When you are done press CTRL+SHIFT+ENTER (also known as CSE). This should cause {} to appear around the formula placing the {} on your own manually does not work for the formula. Then copy and paste...do not drag...the cell with the formula down as far as you need to go. You will have a unique list of names from your matrix.
UPDATE BASED ON COMMENT DATA
+----+------------+------------+------------+
| | D | E | F |
+----+------------+------------+------------+
| 3 | 6 | 7 | 8 |
+----+------------+------------+------------+
| 4 | Company 1 | Company 2 | Company 1 |
| 5 | Company 2 | Company 3 | Company 3 |
| 6 | Company 3 | Company 4 | Company 5 |
| 7 | Company 4 | Company 5 | Company 7 |
| 8 | Company 5 | Company 6 | Company 8 |
| 9 | Company 6 | Company 7 | Company 9 |
| 10 | Company 7 | Company 8 | Company 10 |
| 11 | Company 8 | Company 9 | Company 11 |
| 12 | Company 9 | Company 10 | Company 12 |
| 13 | Company 10 | Company 11 | Company 13 |
+----+------------+------------+------------+
I placed the formula in J3 with CSE and copied down (not dragged down). note the address reference changes to so how the formula was modified to suit your data.
=INDIRECT(TEXT(MIN(IF(($D$4:$F$13<>"")*(COUNTIF($J$2:J2,$D$4:$F$13)=0),ROW($4:$13)*100+COLUMN($D:$F),7^8)),"R0C00"),)&""
not the column selection where I pasted the array formula. It is longer than the list of names. When this happen, "" is returned.

Count distinct occurrences and averages in a column based on identifiers in another column

In MS Excel, I want to count the number of distinct categories (ignoring a specific item) based on a different column. Also, I want to find the average and the max for the same selection. This is the data:
+--------+-----------+-------+
| Person | idea | score |
+--------+-----------+-------+
| George | vacuum | 9 |
| George | box | 6 |
| George | x | 1 |
| Joe | scoop | 4 |
| Joe | x | 1 |
| Joe | x | 1 |
| Joe | scoop | 4 |
| Joe | gear | 7 |
| Mike | harvester | 10 |
| Mike | gear | 7 |
| Mike | box | 6 |
+--------+-----------+-------+
The result should be the following:
+--------+----------------+------------+-----------+
| Person | distinct ideas | Avg. score | Max score |
+--------+----------------+------------+-----------+
| George | 2 | 5.3 | 9 |
| Joe | 2 | 3.4 | 7 |
| Mike | 3 | 7.7 | 10 |
+--------+----------------+------------+-----------+
Because Joe has two "scoop" and one "gear" idea, and I want to ignore the "x" items.
I reluctantly gave up and did it manually for each person, e.g., this is for the first person:
SUM(IF(FREQUENCY(MATCH(B2:B4,B2:B4,0),MATCH(B2:B4,B2:B4,0))>0,1))-IF(COUNTIF(B2:B4,"x")>0,1,0)
Doesn't Excel have functions to return a range instead of a value? If I could select the range based on the name of the person in the first columns, I could count distinct occurrences or find the average in another column.
Add a 4th column and label it Distinct Ideas
If your table starts in A1, then:
EDIT: Formula changed to exclude "x". Screen shot also changed
D2: =IF(TRIM($B2)="x",0,IF(SUMPRODUCT(($A$2:$A2=A2)*($B$2:$B2=B2))>1,0,1))
and fill down.
Then construct a Pivot table
Person to Row Labels
Distinct Ideas to Values area
score to Values and select to Average
Score to Values area and Select Max
Format as desired. Here is one result:

Can I populate a column with conditional data while omitting empty rows or possibly autosort?

In one spreadsheet document, file.xlsx, I have 2 sheets. Sheet1 has the editable fields. Sheet 2's sole purpose is to read the data from Sheet1.
The point is to keep track of inventory and easily display items needed to be ordered.
Sheet1 'column a' is item number for ordering
Sheet1 'column b' is the number I have on hand
Sheet1 'column c' is the formula cell to find the number needed to be ordered
It looks something like this:
Document1:sheet1
A | B | C |
1 |txt1 | 1 | =10-b1 |
2 |txt2 | 0 | =10-b2 |
3 |txt3 | 13 | =10-b3 |
4 |txt4 | 5 | =10-b3 |
5 |txt5 | 2 | =10-b4 |
There is some if statement conditional formatting in the "C" column to check if the "B" column has a value HIGHER than 10 and if it hits true then the corresponding C cell is blank but for space, i'm summarizing here
Document1:sheet2
A | B |
1 |=if(sheet1!C1>0,Sheet1!A1,"") |=if(sheet1!C1>0,Sheet1!C1,"") |
2 |=if(sheet1!C2>0,Sheet1!A2,"") |=if(sheet1!C1>0,Sheet1!C2,"") |
3 |=if(sheet1!C3>0,Sheet1!A3,"") |=if(sheet1!C1>0,Sheet1!C3,"") |
4 |=if(sheet1!C4>0,Sheet1!A4,"") |=if(sheet1!C1>0,Sheet1!C4,"") |
5 |=if(sheet1!C5>0,Sheet1!A5,"") |=if(sheet1!C1>0,Sheet1!C5,"") |
If an item isn't to be ordered because stock is high, it doesn't show up in the list. This is ok. It looks like this:
Document1:sheet2
A | B |
1 | txt1 | 9 |
2 | txt2 | 10 |
3 | | |
4 | txt4 | 9 |
5 | | |
What I would like to see is:
Document1:sheet2
A | B |
1 | txt1 | 9 |
2 | txt2 | 10 |
3 | txt4 | 9 |
4 | | |
5 | | |
For 5 Items in the example, it doesn't seem that annoying, but in actuality I have 1200 potential rows and it varies between 200 to 800 actually populated each time i conduct inventory. The whole point is to have one continuous section of rows that I can select and print. Maybe some way of autosorting and placing the empty ones on the bottom?
I've taught myself excel. I don't know the advanced tricks and things.
I'm a typically a programmer but I've been tasked with this project and the guys upstairs want me to do it in excel.
i've overcomplicated this, to the max.
a simple sort putting the empty's at the bottom is the resolution.
not quite as automated as i'd like
but
it works.

Resources