I have a data set (a lot more columns involved than example) however, want to summarize outcomes on a separate sheet.
Well, can’t use pivots as I have to drop data in from an external source prior to the desired outcome.
Staff names will not be sorted also. There are 9 possible outcomes of 1 visit.
DATA EXAMPLE
Staff Name Status Of Visit
Staff 1 Successful 1
Staff 1 Successful 2
Staff 1 Unsuccessful 1
Staff 1 Unsuccessful 2
Staff 1 Closed 1
Staff 1 Successful 3
Staff 1 Successful 4
Staff 1 Successful 5
Staff 1 Closed 2
Staff 2 Closed 1
Staff 2 Successful 2
Staff 2 Closed 1
Staff 2 Unsuccessful 1
Staff 3 Successful 3
Staff 3 Successful 1
Desired Output
Staff Name Successful Unsuccessful Closed
Staff 1 5 2 2
Staff 2 1 1 1
Staff 3 2 0 0
and this is the formulas i have used for the staff names
=UNIQUE(staffnames)
and for the counts
=COUNTIFS(staffnames,$D3,B:B,E$2&"*")
but i assume there may be much better way to resolve this, can anyone help
You can try:
Formula in D1:
=LET(X,TRANSPOSE(UNIQUE(TEXTBEFORE(B2:B16," ",-1))),Y,UNIQUE(A2:A16),VSTACK(HSTACK(A1,X),HSTACK(Y,COUNTIFS(A2:A16,Y,B2:B16,X&"*"))))
Related
In excel I have a dataset. This represents how much stock of 2 products is sold in the first, second, third, etc... month of the product being on the shelves (starts in A1):
Month 1 2 3 4 5 6 7 8 9 10 11 12
Product 1 3 5 2 1 6 1 2 4 7 2 1 5
Product 2 2 1 5 6 2 8 2 1 2 3 4 9
However, the first product sales do not always occur in month 1. They occur in month X. Is there a way (not VBA or copy and paste) of shifting the entries right by 'x' so they align with the month.
Example for data above
Product 1 starts in month 2
Product 2 starts in month 5
Month 1 2 3 4 5 6 7 8 9 10 11 12
Product 1 0 3 5 2 1 6 1 2 4 7 2 1 5
Product 2 0 0 0 0 2 1 5 6 2 8 2 1 2 3 4 9
*0 not required (great if possible), but more for illustration
Thanks
I have created a simple example that does the same job. The shown formula is copied over the shown cells in the row of new data. (The number '2' in the formula refers to the column number of the starting data cell which is column B, hence 2.)
i have a list where employees are listed and next to it the clients afther that a 1 or 0 if there has been contact with the cliënts for longer than 3 months
now i want to visualise the list but i cant get the total per employee. i have grouped by employee but that doesn't seem te work.
example:
**Employee Cliëntname longer than 3 months**
1 1 0
1 33 1
1 12 0
**total 1**
2 2 1
2 3 1
**total 2**
can anyone help me with this
Have you tried:
total([longer than 3 months] for [Employee])
I have two sheets sheet 1 and sheet 2, what I have to do is copy the values in sheet 1 to sheet 2
sheet 1 : I have two type of users with corresponding weights
user 1 user 2 7
user 1 user 3 19
user 1 user 7 5
user 3 user 2 1
user 2 user 7 1
sheet 2
user 1 user 2 user 3 user 7
user 1
user 3
user 2
user 7
The final result should be something like this: user 1 - > user two has weight 7 so this value appears in that cell and so on
user 1 user 2 user 3 user 7
user 1 0 7 19 5
user 3 0 1 0 0
user 2 0 0 0 1
user 7 0 0 0 0
Is there a way to do this? I know I can pass values between two excel sheets but I'm confused how to do this in this case
UPDATED: CIRCULAR REFERENCE ERROR
sheet 2
Assuming both the sample you have given starts from the top left of the sheet, enter the following formula in B2 (for user 1, user 1) and drag across the table:
=SUMIFS(Sheet1!$C:$C,Sheet1!$A:$A,$A2,Sheet1!$B:$B,B$1)
The output will be:
user 1 user 2 user 3 user 7
user 1 0 7 19 5
user 2 0 0 0 1
user 3 0 1 0 0
user 7 0 0 0 0
It uses the users in the row and column as the criteria to match the same in column 1 and 2 of sheet 1, and adds the weight. This will work regardless of whether there is duplication or not.
I am trying to work out the ranking of top 3 users at different organisations and have the data presented horizontally for each user so it can be inputted into our email system to personalise emails.
I am able to create a ranking vertically but I am not sure how to get the formula to rank based on organisation and return value across.
Here is what I need to have in the end:
Name Organisation Usage First Second Third
User 1 Organisation 1 8 User 3 User 5 User 2
User 2 Organisation 1 10 User 3 User 5 User 2
User 3 Organisation 1 222 User 3 User 5 User 2
User 4 Organisation 1 1 User 3 User 5 User 2
User 5 Organisation 1 14 User 3 User 5 User 2
User 1 Organisation 2 215 User 4 User 1 User 5
User 2 Organisation 2 18 User 4 User 1 User 5
User 3 Organisation 2 12 User 4 User 1 User 5
User 4 Organisation 2 310 User 4 User 1 User 5
User 5 Organisation 2 161 User 4 User 1 User 5
I can return a ranking vertically one organisation at a time using
=INDEX($A$2:$A$6,MATCH(1,INDEX(($C$2:$C$6=LARGE($C$2:$C$6,ROWS(H$1:H1)))*(COUNTIF(H$1:H1,$A$2:$A$6)=0),),0))
If someone could help me run this formula based on each organisation and horizontally that would be fantastic!
Thanks,
Sarah.
Non-Empty Usage Solution:
Assuming your data starts in A1 Like so:
A B C D E F
---------------------------------------------------------
1 | Name Organisation Usage First Second Third
2 | User 1 Organisation 1 8 User 3 User 5 User 2
3 | User 2 Organisation 1 10 User 3 User 5 User 2
4 | User 3 Organisation 1 222 User 3 User 5 User 2
5 | User 4 Organisation 1 1 User 3 User 5 User 2
6 | User 5 Organisation 1 14 User 3 User 5 User 2
7 | User 1 Organisation 2 215 User 4 User 1 User 5
8 | User 2 Organisation 2 18 User 4 User 1 User 5
9 | User 3 Organisation 2 12 User 4 User 1 User 5
10| User 4 Organisation 2 310 User 4 User 1 User 5
11| User 5 Organisation 2 161 User 4 User 1 User 5
You can change your formula starting in D2 to:
=INDEX($A$2:$A$11,MATCH(1,INDEX(($C$2:$C$11=LARGE(($B$2:$B$11=$B2)*$C$2:$C$11,COLUMNS($C2:C2)))*(COUNTIF($C2:C2,$A$2:$A$11)=0),),0))
What I changed:
Added ($B$2:$B$11=$B2) inside the LARGE which multiplies all the Usage values for other organizations by 0. Which then won't be picked up by the LARGE function.
Changed the ROWS(H$1:H1) to COLUMNS($C2:C2) so you can rank horizontally
I also changed the cell references to the entire dataset rows 2 to 11
Solution with possible empty Usage:
If the Usage is empty (for all users in the same organization) and you desire the First, Second, and Third column to be blank then also, like so:
A B C D E F
---------------------------------------------------------
1 | Name Organisation Usage First Second Third
2 | User 1 Organisation 1 8 User 3 User 5 User 2
3 | User 2 Organisation 1 10 User 3 User 5 User 2
4 | User 3 Organisation 1 222 User 3 User 5 User 2
5 | User 4 Organisation 1 1 User 3 User 5 User 2
6 | User 5 Organisation 1 14 User 3 User 5 User 2
7 | User 1 Organisation 2
8 | User 2 Organisation 2
9 | User 3 Organisation 2
10| User 4 Organisation 2
11| User 5 Organisation 2
We can accomplish this by checking if the entire Usage for the Organization is 0. Then we can blank out all the ranks for that Organization.
To check if the sum of the usages for the organization is 0 we can use SUMPRODUCT: So for cell D2 that would look like:
=SUMPRODUCT(($C$2:$C$11)*($B$2:$B$11=$B2))=0
Then we can just wrap an IF around everything and blank it if the above statement returns true. So our final formula would look like:
=IF(SUMPRODUCT(($C$2:$C$11)*($B$2:$B$11=$B2))=0,"",INDEX($A$2:$A$11,MATCH(1,INDEX(($C$2:$C$11=LARGE(($B$2:$B$11=$B2)*$C$2:$C$11,COLUMNS($C2:C2)))*(COUNTIF($C2:C2,$A$2:$A$11)=0),),0)))
^^ Throw whatever you want in there
Now if you want the text to say anything else, just put that text inside the quotes for the TRUE condition of the IF statement.
I need to determine the range to apply the Frequency function. Here's what the problem is. On the given sheet, I have subtotals for my data and there is a column which has "Stop" Values.
The data would look something like:
Route1
Order# Stop# Qty
001016 1 5
008912 1 5
062232 2 6
062232 3 2
069930 4 1
1000 4 3
1001 4 4
1001 5 8
1003 8 1
Route 1 Subtotal 6 35
Route2
Order# Stop# Qty
10065 1 5
10076 1 5
10077 2 6
10079 3 2
10087 4 1
10098 4 3
10109 4 4
10171 5 8
10175 8 1
Route 2 Subtotal 6 35
How do I write VBA code for calculating the distinct stop values. I need the distinct count of the stop#. Hence in the example above you can see that the total stops are 6 because 1 stop can have multiple orders and 1 route can have multiple orders/stop. Hope I am making sense here. Let me know how I would write my VBA code for this. Thanks for your help.
For the Stop Subtotal unique count, try this formula (adjust ranges as required):
=COUNT(1/FREQUENCY(B2:B10,B2:B10))