Total points for each student in Google spreadsheet or excel - excel

I am in the process of creating a Google form, which students will fill out after attending an event. Based on the event they attend, I will be assigning points to them and this form can be submitted through the whole year.
Is there a way to get a total number of points for each students, since they'll be submitting the form multiple times, I need a way to tally up the points for each students
Example spreadsheet goo.gl/1aunYg
Sam | 2
Jon | 2
Mike | 2
Don | 2
Sam | 3
Sam | 1
Jon | 2
Mike | 1
Total for Sam: ???
Total for Jon: ???
Total for Mike: ???
Total for Don: ???

In google spreadsheets, assuming you have the names in Col A and the scores in Col B, you can also try:
=query(A2:B; "select A, sum(B) where A <>'' group by A label sum(B) 'Totals' ")
This should output an array of unique names and the summed scores.

Sort the list on Name (Home>Sort & Filter)
Add a heading for the columns
Apply SubTotals (Data>Subtotal in the Outline group) at each change in Name and using the function Sum.
You can then hide/show individuals using the controls on the LH side.

Google Spreadsheet see SUMIF
In Excel you could do something like ...

Related

Count unique records with conditional statement in EXCEL

I have a table in Excel.
Id|Gender|Age|Test|Result|Center
1 |MALE |11 | HB | 11 |Center1
1 |MALE |11 | UA | 8 |Center1
1 |MALE |11 | BG | 100 |Center1
2 |FEMALE|12 | HB | 12 |Center1
2 |FEMALE|12 | UA | 10 |Center1
3 |MALE |14 | HB | 14 |Center2
4 |FEMALE|13 | HB | 15 |Center2
I am able to find unique records but not getting how to put a conditional statement over it. Below is the queries I need.
Total males: 2
=SUMPRODUCT((report!D2:D232="MALE")/COUNTIF(report!B2:B232,report!B2:B232&""))
Total Females:2
=SUMPRODUCT((report!D2:D232="FEMALE")/COUNTIF(report!B2:B232,report!B2:B232&""))
I need the following queries.
Total Females with HB result above 14. ??
Total Females with HB result between 10 and 14 in Center1??
EDITS:- Every count should be from the unique counts from males and females.
Thanks in advance.
Total Females with HB result above 14
You can use COUNTIFS to specify multiple criteria in this case:
=COUNTIFS(B2:B232,"FEMALE", D2:D232,"HB", E2:E232, ">14")
This contains three checks:
Does B2:B232 = FEMALE?
Does D2:D232 = HB?
Is E2:E232 > 14?
In the case of your sample data, this outputs 1.
Total Females with HB result between 10 and 14 in Center1
Again, use COUNTIFS with multiple parameters:
=COUNTIFS(B2:B232,"FEMALE", D2:D232,"HB", E2:E232, ">=10", E2:E232, "<=14", F2:F232, "Center1")
In this case, these are the checks:
Does B2:B232 = FEMALE?
Does D2:D232 = HB?
Is E2:E232 >= 10?
Is E2:E232 <= 14?
Does F2:F232 = Center1?
The output in the example data is again 1.
You could also use Format-as-table on the table and set a total row and set it to Count.
This way, as you filter on your conditions in each column, you will get a list with the subjects that fit the query as well as the total number of occurrence within the queried. This will however not find the unique Id's. See bootom of answer on how to do that with a matrix-formula
Result for query: Female with HB above 14:
Result for query: Female with HB between 10 and 14 in Center1:
To count unique ID's in the filtered table use this matrix-formula (apply with CTR+SHIFT+ENTER):
=SUM(--(FREQUENCY(IF(SUBTOTAL(3; OFFSET(A2:A8; MATCH(ROW(A2:A8); ROW(A2:A8))-1; 0; 1));COUNTIF(A2:A8;"<"&A2:A8);"");COUNTIF(A2:A8;"<"&A2:A8))>0))
More info on this formula can be found here: https://www.get-digital-help.com/count-unique-distinct-values-in-a-filtered-table/
This would look like this:
You could modify the below:
Formula:
=SUMPRODUCT(($A$2:$A$8=H3)*($B$2:$B$8=I3)*($C$2:$C$8=J3)*($D$2:$D$8=K3)*($E$2:$E$8=L3)*($F$2:$F$8=M3))
Results:
For Office 365 Excel:
If you want a
Count of unique individuals meeting your criteria
A method of easily changing the criteria
And assuming that
ID identifies the individuals
You have Excel 2016 with the new UNIQUE and FILTER functions
I suggest the following which will use the Advanced Filter
*You could also use a simple filter, but it may be a bit more difficult to set up the varying filter criteria, and they would not be visible in the results display**
Turn your data range into a Table and name it myTbl
Add a Helper column named Visible
Optionally you may HIDE this column
Formula for helper column: =SUBTOTAL(3,[#ID])
*This will return 0 if row is hidden, else 1
Use this formula for a Unique Count: =COUNTA(UNIQUE(INDEX(FILTER(myTbl[ID],myTbl[Visible]=1),0,1)))
Set up a Criteria Range where you can type in the Criteria
See HELP for Advanced Filter for more information
Examples: (I changed your data a bit to test for uniqueness)
Base Data and empty Filter
Total Females with HB result between 10 and 14 in Center1
If you prefer not to use a filter, or a helper column, here is a formula to return this same last set of criteria:
=COUNT(UNIQUE(INDEX(FILTER(myTbl,(myTbl[Gender]="FEMALE")*(myTbl[Test]="HB")*(myTbl[Result]>=10)*(myTbl[Center]="Center1")),0,1)))
You can use this as an example as to how to create formulas to return a unique count of any other sets of criteria.
EDIT:
If you choose to use the Advanced Filter method with the Visible helper column, and if your ID's are all numeric, you can use this formula to obtain the Unique Count:
=SUM(IF(FREQUENCY(IF(myTbl[Visible],myTbl[Id]),IF(myTbl[Visible],myTbl[Id]))>0,1))
In versions of Excel that do not have dynamic array formulas, you must confirm the formula by holding down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula seen in the formula bar.

Search a Column for Specified Text, Then Return the Sum of the adjacent column which contains values to sum

I am creating a World Cup spreadsheet.
Example:
Team | Pts |
Brazil | XXX |
Switz. | XXX |
C. Rica| XXX |
Serbia | XXX |
I have another table which displays the Country, Score & whether it was a W (win), L (loss) or T (tie). A WIN will add 3 points, a TIE will add 1 point & a LOSS will add 0 points. Where I put the XXX, I want a formula that will search the table column for the Country Name and ADD up the W's, L's & T's and display the sum of every game there team played with the point system I mentioned.
Any help would be greatly appreciated! Thanks.
Try,
=SUM(COUNTIFS(D:D, A2, E:E, {"T","W","W","W"}))
You can use COUNTIFS. I set up a mock table to demonstrate:
The first COUNTIFS will count a given teams wins, and then multiple by a factor of 3.
The second COUNTIFS will count a given teams ties (no need to multiply here).
Since a Loss equates to 0 points, there is no need to sum or count anything.
Adjust ranges to fit your setup and then auto-fill the equation down your table to calculate for each team.
You can use a formula in H2, as below, and drag down as many rows as required
=(3*SUMPRODUCT(--($A$2:$A$13=$G2),--($C$2:$C$13="W"))+SUMPRODUCT(--($A$2:$A$13=$G2),--($C$2:$C$13="T")))
Data:
You only care about Wins or Ties. So count the wins per country and * 3 and add to that the count of ties, which you don't need to multiply as is 1.
Sumproduct is used to handle the arrays nicely.

Using cell value to set price in another cell

I have a spreadsheet with a list of T-shirts and all of their varying sizes from Small to XL. I was just wondering if there is a way to create a formula that will set the price of the shirt in another row. I was messing around with formulas and the only one I could get to sort of work (for only ONE t-shirt size) was the following:
=IF(COUNTIF(K:K,"S"),25)
Is there a way to have multiple statements for the different sizes? Thanks in advance!
I would create a
"reference table" in a separate sheet and then do a vlookup.
So the table would look like below and then just do a vlookup to where all your shirts are at.
Size | Price
XS | 5
S | 10
M | 15
L | 20
XL | 5

Look for multiple occurences of text (partial match)

I am struggling to solve the below problem:
I have a list of users who have attended various numbers of courses. Now I want to find which courses each person has attended and list them in a new sheet. Below is a picture of my sheet:
Names | Courses
--------------------------------------------------------------------------------------
Farnaz Hossein Zadeh, Elena Pak, Mehran Behzadi, Atefeh Ghorbani, John Smith | AP01
John Smith, Farnaz Hossein Zadeh, Tom green | AP03
John Smith | AP05
And I need to get:
F G H
Farnaz Hossein Zadeh AP01 AP03
As far as I know, this is not quite possible with Excel formulas alone.
First, you need to clean up your data. Your can use Data > Text to columns to separate the comma-separated data. Then, make that data vertical so that you effectively have a list of pairs course-student. Then you can list unique courses by doing a pivot table on your data.

Report generation based on multi lookup and dynamic columns

I am a little stuck with a report I am trying to generate in Excel and was hoping someone could help.
Here is a summary of what I am trying to do:
Table 1 has one column called people (it’s basically a list of
employees)
Table 2 has one column called countries (it’s basically a
list of relevant countries)
Table 3 has three columns called person,
country and date.
There is one entry for every person each time they review a country.
So the data will look something like:
PERSON | COUNTRY | DATE
John | uk | 10/01/2013
Paul | uk | 15/01/2013
John | France | 15/01/2013
Bob | Spain | 16/01/2013
The report I need to produce is one which shows who has/hasn't checked each country.
So the columns will be ‘Person’, uk, France, Spain (and any other unique value from the country table).
There will then be one single row for each person with a Yes/No value in the relevant column if that person has reviewed that country i.e. Table 3 contains a value that matches that value for the person and country.
So to be clear the report should be similar to:
PERSON | UK | FRANCE | SPAIN
John | Yes | Yes | No
Paul | Yes | No | No
Bob | No | No | Yes
In summary I can split this into two problems:
How to generate a table that has a column for every unique value in another table (country in the explanation above)
How to do a double lookup i.e. IF EXISTS in TABLE 3 ‘person’=john & ‘country’=uk then return ‘Yes’, otherwise return ‘No’
I’m happy to keep in Excel or make use of SQL reporting i.e move my data to SQL first.
It's kind of a wonky formula but =sumproduct() will do a dual lookup.
=IF(SUMPRODUCT(--($K$2:$K$5=$K13), --($L$2:$L$5=M$10)),"Yes","No")
The Person/Country/Date table is located in the range K1:M5 the results table is located in range K10:N13. I had a workbook open and put it in the corner. (Nobody puts sumproduct in the corner)
The gist is, -- turns a true and false into a 1 or 0. sumproduct will multiply the two results line by line. If both are true, you get 1 x 1 and funnels that back into the if for a yes and no. You'll have to be mindful of th $ in the formula.

Resources