Calculate the percentage of a column - calculated-columns

I have loaded an Excel sheet into Tableau:
File_name, Category
A, CCCCC
A, CCCCC
B, CCCCC
C, EEEEE
D, EEEEE
E, WWWW
F, WWWW
I need to calculate: what percentage of Files are in Category CCCCC?
In this example, there are 6 distinct files (A, B, C, D, E, F). Two of them are in Category CCCCC (i.e. File A, B). Hence, the percentage of Files that are in Category CCCCC are: 2 out 6, i.e. 33%.
How do I calculate this percentage and display it on Tableau? Thank you!

First drag category and then File Name to rows. Later right click on File name and choose measure (count distinct)-Step1 and change to discrete- Step 2. Now, again right click and choose Quick table calculation (Percentage of total) - Step3, then we can see the percentage across as below -

Related

Sort list by the difference between two values

I have the following Excel spreadsheet:
A B C D
1 Budget Actual Sort by Variancy (descending)
2 Product A 500 250 Product F
3 Product B 900 800 Product D
4 Product C 300 450 Product C
5 Product D 400 600 Product B
6 Product E 700 300 Product A
7 Product F 150 900 Product E
As you can see in Column A I have listed different products and in Column B I have their budget value and in Column C the actual value.
Now, I want to list those products based on their budget-actual-variancy in Column D in a descending order (starting from the highest positive variancy).
The only formula which comes in my mind is =LARGE(B2:B7,1) but it only sorts the products by the budget values (Column B) or actual values (Column C). Not by the difference between the two values.
Do you know any formula which I can use to sort the products in Column D based on their variancy?
Please note:
I know I could add a helper column in which I calculate the differences between Column B and Column C and then go with the LARGE function on this helper column but I am looking for a solution without such a helper column.
If one has SORTBY()(Currently only available with Office 365 insiders) then put this in D2 and it will spill automatically:
=SORTBY(A2:A7,B2:B7-C2:C7,1)
You can use the following (even when there are duplicate variances):
Formula in D2:
=INDEX($A$1:$A$7,LARGE(INDEX(($C$2:$C$7-$B$2:$B$7=AGGREGATE(14,3,$C$2:$C$7-$B$2:$B$7,ROW(1:1)))*($A$2:$A$7<>D1)*ROW($A$2:$A$7),),1))
Drag down.
In case of duplicate variances it will grab the last value in column A that represents that variancy and has not been featured in column D as yet.

Formula to reformat of names in excel where column A has Last, First, Middle but not always a middle

I have a column of names (column A) formatted as "Last, First, Full Middle".
However, some of the names in column A do not have a middle name (i.e. only have "Last, First" or "Last, First, Middle initial"). I'm trying to come up with a formula (or multiple) that formats the names so that column B has "Last, First, Middle initial[period]" and column C has "Last, First Middle initial[period]"
E.g., if column A has: Smith, John, David
then I want column B to be: Smith, John, D.
and column C to be: Smith, John D.
I tried the following:
in column B:
=IF(ISBLANK(A2),"",LEFT(A2,FIND("~",SUBSTITUTE(A2," ","~",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))+1)&".")
and in column c:
=IF(ISBLANK(A2),"",SUBSTITUTE(B2,", "," ",LEN(B2)-LEN(SUBSTITUTE(B2," ",""))))
Both formulas work EXCEPT if the name in column A doesn't have a middle name.
Use this in Column B:
=IFERROR(LEFT(A1,FIND("~",SUBSTITUTE(A1,",","~",2))+1)&MID(A1,FIND("~",SUBSTITUTE(A1,",","~",2))+2,1)&".",A1)
and in Column C:
=IFERROR(LEFT(A1,FIND("~",SUBSTITUTE(A1,",","~",2))-1)&" "&MID(A1,FIND("~",SUBSTITUTE(A1,",","~",2))+2,1)&".",A1)

Compare user input to two columns and return value from 3rd predefined column

So I am trying to understand how to use excel to complete this exercise.
Basically, I have 4 columns (A, B, C, D). Looks like this:
A B C D E
CRT Carrot CRT CR
Apple Apple APL AP
Basically, I need to scan down column A and compare it to columns B & C. If the word in A matched either the full word in B or the three letter word in C, then I need to take the two-letter word in D and write it in column E.
I've managed to Use VLOOKUP to scan column A and column C and then append to E, however, I can't figure out how to have excel scan both B & C and then append D to E. (main issue here is that the input in A sometimes matches B and sometimes matched C).
Thanks!
I don't have a full grasp of your issue but have you tried aggregating the conditions in other columns like
Have column G Boolean check if A matches a word in B
Have column H Boolean check if A matches a three letter word in C
Have column I = G OR H
then have your result column based on I?
For what you are trying to achieve you can do with a nested if statement:
In Cell E1, use this fromula:
=IF(A1=B1,D1,IF(A1=C1,D1,""))
With the cell still selected, on the bottom right of the cell you will see a small square, click on this small square and drag down to auto-fill all the cells as required.
Formula: =IF(IFERROR(MATCH(A1,B1:C1,0),0)>0,D1,"")
Results:

Excel Lookup and sum multiple values

A B C D D E F
DEForage201 DE Deutschland 201 Perennial Ryegrass Forage 789951
DEForage201 DE Germany 201 Perennial Ryegrass Forage 5617026
In the list above (starting in column A which is an ID line compiled by column B, F and D) I want to lookup and get the sum of the rightmost column.
Currently I am using vlookup and look for the ID line in column A, until I noticed that the country names in column C would differ during the list which is why I am having identical ID lines in column A and currently only get the first value.
Any ideas how to solve this?
Assuming you're looking for a way to view the sum of column F for each unique combination of columns A through E, a Pivot Table might be what you're looking for. You can select columns A through E as the "rows" for the pivot table, and sum of column F for the values. Adjust the report layout in the Pivot Table Design tab to get it to look the way you want.

Microsoft Excel Referencing data

I am trying to figure out how to look up a cell to see if it contains a name from a list I have specified, we will use "Hofmann Trucking" for example.
Using columns a,b and c where column a contains average hours it takes for truck to travel from point a to point b, column b contains the carrier information (Hofmann Trucking) and finally column c which is where I would like the answer to go.
I want column c to return the time listed in column a, only if Hofmann trucking is the carrier in column b. If another carrier is listed I would like to put that information in column d.
In the end these times will be averaged per carrier per day so I can easily show how much time is spent traveling to and from certain areas by different companies.
This should do it:
Col A Col B Col C Col D
8 Hoffman Trucking =If(B1="Hoffman Trucking",A1,0) =A1-C1
Put those 2 formulas in columns C & D and drag down...

Resources