Tableau - lookup letter grade from range - excel

I have two Excel spreadsheets. One contains average numerical grade for a student and the other a list of letter grades for numeric grades between a min and max
Spreadsheet 1
Student Avg Letter Grade
Mike 91
Joe 76
Mary 84
Sally 78
Spreadsheet 2
Min Max LetterGrade
90 100 A
81 89 B
71 80 C
61 70 D
0 60 F
How do I return the proper grade for each student in Tableau? It seems trivial but I can't figure out the calculation. Thank you for your help!!!

There is an easier way to do this by using Groups.
Import Spreadsheet 1 as a data source
Right Click on "Avg" and select Create Group
From there use Shift Click to group your ranges using Spreadsheet 2 as your reference, using labels "A, B, C"
On the top of the Create Group dialog box, make sure you rename your Field Name as "Letter Grade"
The weakness of this approach is that you have to check/redefine your groups if you are updating your data source. Using IF-ELSEIF statements may be more flexible as Inox suggested in the comments. But this is a relatively easy trick, without any programming involved. :-)
For more info, visit: http://kb.tableau.com/articles/knowledgebase/use-ad-hoc-groups-categorize
Hope this helps!

Related

Google sheets formula to get the Top 5 List With Duplicates

I'm trying to compile a best 5 and worst 5 list. I have two rows, column B with the number score and column C with the name. I only want the list to include the name.
In my previous attempts the formula would get the top/bottom 5 but as soon as a duplicate score appeared the first known name with that value would just repeat.
Here is my data
26 Cal
55 John
55 Mike
100 Steve
26 Thomas
100 Jaden
100 Jack
95 Josh
87 Cole
75 Brett
I've managed to get the bottom 5 list formula correct. This formula works perfectly and includes all names of duplicate scores.
Example of what I get:
Cal
Thomas
John
Mike
Brett
=INDEX($C$56:$E$70,SMALL(IF($B$56:$B$70=SMALL($B$56:$B$70,ROWS(E$2:E2)),ROW($B$56:$B$70)-ROW($B$56)+1),SUM(IF($B$56:$B$70=SMALL($B$56:$B$70,
ROWS(E$2:E2)),1,0))-SUM(IF($B$56:$B$70<=SMALL($B$56:$B$70,ROWS(E$2:E2)),1,0))+ROWS(E$2:E2)))
Here is the formula I've tried to get the top 5 - however I keep getting an error.
=INDEX($C$56:$E$70,LARGE(IF($B$56:$B$70=LARGE($B$56:$B$70,ROWS(E$2:E2)),ROW($B$56:$B$70)-ROW($B$56)+1),SUM(IF($B$56:$B$70=LARGE($B$56:$B$70,
ROWS(E$2:E2)),1,0))-SUM(IF($B$56:$B$70<=LARGE($B$56:$B$70,ROWS(E$2:E2)),1,0))+ROWS(E$2:E2)))
Example of what I'm looking for
Steve
Jaden
Jack
Josh
Cole
You can set two queries like this for both cases:
=QUERY(B56:C70,"Select C order by B desc limit 5")
=QUERY(B56:C70,"Select C order by B limit 5")
Use SORTN() function like-
=SORTN(A1:B10,5,,1,1)
To keep only one column, wrap the SORTN() function with INDEX() and specify column number. Try-
=INDEX(SORTN(A1:B10,5,,1,1),,2)

extract values based on two columns

I would like to extract a price value based on two other columns. In table 1, I am given the raw data where I want to draw from. In Table 2, I am given only the contract number, and I would like to find the type being "Mater" and have the price listed out for it.
I've tried to use this formula but I don't think I am calling the columns correctly.
=IF(AND(Table2!A1=Table1!$A$1:$A$6,Table1$C$1:$C$6="Mater"),Table1!$D$2:$D$6,"")
Is there a formula using index match, if(and), or another one that could work in this case?
Thank you!
Table 1.
Contract
Work
Type
Cost
5321a
aaa
Labor
52
5321a
ab
Mater
57
5641a
aba
Mater
10
536451a
aae
Labor
75
2441a
aan
Labor
42
53421
aar
Mater
14
Table 2
Contract
Mater Cost
5321a
57
5641a
57
53421
14
The following should work:
=SUMIFS(Sheet1!D2:D7,Sheet1!A2:A7,A2,Sheet1!C2:C7,"Mater")
(I'm assuming the first table in on Sheet1)

How to compare multiple values from different columns in excel?

I have some difficulties with my IF formula.
I have the following columns that represent some subjects and the points that I managed to get for those subjects (F:H). In column I , I would like to compare my points with another table(M:N) that contains the minimum amount of points needed to pass the course .If my score is equal or greater then what the corresponding score is in column N, I would like to show PASS or FAIL in column I.
I Used the following formula but when comparing with M:N it keeps going down (outside the table) giving me in the end all the exams as passed.
=IF(AND(F2:$F$6=M2:$M$6)&H2:$H$6>=N2:$N6;"PASS";"FAIL")
F H I M N
(Subjects) (Points) (Subjects) (Points to Pass)
Mathematics 85 Mathematics 85
English 88 English 70
French 78 French 60
Chinese 56 Chinese 60
Physics 70 Sports 80
Sports 95 Physics 80
You could use:
=IF(H2>=VLOOKUP(F2,$M$2:$N$7,2,FALSE),"PASS","FAIL")
Results
Example formula should look like this:
=IF(H1>=INDEX($N$1:$N$6,MATCH(F1,$M$1:$M$6,0)),"PASS","FAIL")
Let your table layout housed in F1:N7 include header
In I2, formula copied down :
=IF(H2>=VLOOKUP(F2,M:N,2,0),"PASS","FAIL")

Arranging a grade-table in a spreadsheet

I am giving a homework exercise that the student can submit in singles or pairs. The solutions are submitted in a Google form with three fields: submitter1, submitter2 (optional), solution. The submissions automatically go into a Google spreadsheet with four columns: submitter1, submitter2, solution, and grade (filled in by the TA). For example:
submitter1 submitter2 solution grade
111 222 x 100
333 y 90
444 555 z 80
I would like to create a second sheet that automatically lists the grades of each submitter alone, e.g:
submitter grade
111 100
222 100
333 90
444 80
555 80
The order in the second table is not important.
Is there a way to do this in Google spreadsheet?
Alternatively, is there a way to do this in another spreadsheet software, such as LibreOffice Calc or Excel? (in that case I could copy the spreadsheet to that program and do the calculations there, though it is less convenient than doing it directly in Google spreadsheet).
EDIT: The main problem is to collect all submitter IDs into a single column. I do not know in advance how many submissions there will be, and how many of them will be single/pair. I tried to put in the "submitter" column:
=IF(ISBLANK(Sheet1!A2),Sheet1!$B$2,Sheet1!A2)
and copy it downwards. This gives me all the first-submitters, and then the first second-submitter. But then how to automatically take the next second-submitters?
List the submitters with this in A2,
=ArrayFormula(UNIQUE(TRANSPOSE(SPLIT(CONCATENATE(Sheet1!A2:B&CHAR(9)),CHAR(9)))))
Retrieve their grades with this formula,
=index(Sheet1!D:D, iferror(match(A2, Sheet1!A:A, 0), match(A2, Sheet1!B:B, 0)))
Linked google-sheet here (updated)
=UNIQUE({{Sheet1!A:A,Sheet1!D:D};{Sheet1!B:B,Sheet1!D:D}})
Arrange arrays and do the formulas. QUERY to remove blanks, if needed:
=QUERY(UNIQUE({{Sheet1!A:A,Sheet1!D:D};{Sheet1!B:B,Sheet1!D:D}}),"Select Col1,Col2 Where Col1 is not null")

How can I merge rows in Excel 2010?

My Excel sheet contains columns for id, date, amount and name.
If two or more rows have the same id and name I want to merge them into one row with the amount of those two combined. Can anybody help me doing this?
Use concatenation with Columns ID and NAME (=ID&NAME) in another column and look for the pivot table. Move to Insert->Pivot table option to get the attached answer]
Hope this clarifies
Here is a possible solution (as far as I understand the problem) using a PivotTable:
As you can see, there is not really much to it. Just insert a pivot table and drag the ID & Name to the Rows while you move the dates and the values to the Values section of the pivot table. The Values in the Column section will be automatically generated.
The only thing I changed at the end was to format the pivot table nicely doing the following:
Remove SubTotals by name
Using a PivotTable style that I like from the PivotTable menu in the section Design.
Show items in a tabular format. That means that the name and the ID are shown on one row and not in a cascading format (ID in one row and the name in a second row underneath + indented). You can achieve this by right-clicking on the name and selecting Field Settings. A new window opens (showing the settings). Go here to the Layout & Print tab and select Show item labels in a tabular form. You might have to repeat that for the field Name and the field ID (depending on which of the two fields you chose to show first in the Rows section of the PivotTable).
Let me know if this solved your problem or if you have any questions.
Note: since no sample data has been provided I made some up. I sure hope this data is somewhat similar to what you are trying to aggregate.
Used sample data:
ID Date Amount Name
1 05.03.2015 121 Peter
2 14.01.2015 127 Max
3 11.01.2015 77 Eva
4 06.11.2015 141 Jamie
5 04.03.2015 58 Sophie
1 04.04.2015 94 Peter
7 20.06.2015 52 Lucas
3 14.12.2015 136 Eva
2 02.11.2015 93 Max
10 20.08.2015 59 Mason
4 11.01.2015 145 Jamie
4 02.02.2015 113 Jamie
4 26.02.2016 89 Jamie
1 30.03.2016 137 Peter
15 09.09.2015 81 Jackson
16 25.02.2015 61 Liam
2 26.02.2016 133 Max
2 26.10.2015 80 Max
19 25.09.2015 76 Aiden

Resources