Formula to calculate grade using selected best questions answered - excel

Data below shows the maximum score for every question in an exam, and the score of a student. What excel formula can I use to calculate student score using his best 7 questions answered?
Question 1 2 3 4 5 6 7 8 9 Total
Marks 10 15 10 5 15 10 10 15 10 100
Student score
John D 0 6.5 4 0 3 0 7 2 5 27.5

I think I've come up with something that should almost fulfill your requirement.
Solution can be broken down into following steps:
1. Get the top 7 scoring answers (this is based on your comment where you mentioned that 6 out 10 is better than 6.5 out of 15). As per the data provided in the question best performing score would be 7/10 followed by 5/10, 6.5/15, and so on.
Write the below formula in the Cell B6 and drag/copy across till H6 to get these values.
=LARGE(($B$4:$J$4)/($B$2:$J$2),COLUMN(B1)-COLUMN($B$1:$H$1)+1)
This is an array formula so commit it by pressing Ctrl+Shift+Enter
2. Now we have top 7 scores in Row 6. On the basis of these values get their corresponding marks. For this enter the following formula in Cell B7
=INDEX($B$2:$J$2,1,SMALL(IF((($B$4:$J$4)/($B$2:$J$2)=B6),COLUMN($B$1:$J$1)-COLUMN($B$1)+1),COUNTIF($B$6:B6,B6)))
and drag/copy across till H7.
Again this is an array formula.
3. After getting marks its time to get scores. Use below formula in Cell B8 and drag/copy across till H8
=INDEX($B$4:$J$4,1,SMALL(IF((($B$4:$J$4)/($B$2:$J$2)=B6),COLUMN($B$1:$J$1)-COLUMN($B$1)+1),COUNTIF($B$6:B6,B6)))
This is an array formula too.
4. In Cell K7 and Cell K8 enter =SUM(B7:H7) and =SUM(B8:H8) respectively.
5. To get the percentage of the top 7 scoring questions with respect to marks allotted write =K8/K7.
Drawback of this solution:
When ever there is tie in values in the Row 6 this may not give you desired result. By saying tie I do not mean same score (eg. 2/10, 2/15) instead I am talking about performance on each question like 2/10 and 3/15 both will give same result as far as performance is concerned.
In the sample data provided in the question John has three scores of 0's (one out of 10 and other two out of 15). Mathematically all three are same however if you want to include score of 0/10 in top 7 considering that it is better than 0/15, this may not happen. In case of tie the above formulas will get value in the order of occurrence i.e. if 0/15 appears before 0/10 then its 0/15 that will be considered in the formula and not 0/10. See the image for reference.
If you have any queries let me know.

Related

count how often a piece of information appears and calculate that average

I do not want to know the traditional frequency or the traditional averages; so I'll give an example below:
I have this data:
1
3
5
5
2
3
5
5
1
3
The analysis that I would like to obtain is the following:
for example number 1 appears once every eight rows, number 3 appears once every four rows, number 5 appears twice every two rows....
I did it by hand, but now I have more than 21000 rows of data and I'm stuck.
I searched but I can not find a function that does it; But before I started developing my own, I decided to ask for a guide on how to achieve it.
I believe that I was able to achieve the desired result:
The formula is:
Or, if you want to copy/paste:
=IF(CONCATENATE("1-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+1,1,4)&":A17"),0))="1-1",CONCATENATE("2-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+2,1,4)&":A17"),0)-1),CONCATENATE("1-",MATCH(D1,INDIRECT(ADDRESS(MATCH(D1,A1:A17,0)+1,1,4)&":A17"),0)))
Note that the IF function solves the duplicates (like the number 5). In case you have triplicates you will have to add another instance of IF and adjust the formula accordingly.
Hope that helps!
Well this doesn't exactly reproduce your results, but you could start by looking at the max and min separation of the numbers:
=IF(COUNTIF(A$1:A$10,C2)<=1,"",MIN(IF((ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))>1)
*(ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))<=COUNTIF(A$1:A$10,C2)),
FREQUENCY(IF(A$1:A$10<>C2,ROW(A$1:A$10)),IF(A$1:A$10=C2,ROW(A$1:A$10)))))+1)
=IF(COUNTIF(A$1:A$10,C2)<=1,"",MAX(IF((ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))>1)
*(ROW(A$1:INDEX(A$1:A$10,COUNTIF(A$1:A$10,C2)+1))<=COUNTIF(A$1:A$10,C2)),
FREQUENCY(IF(A$1:A$10<>C2,ROW(A$1:A$10)),IF(A$1:A$10=C2,ROW(A$1:A$10)))))+1)
This gives the min or max number of rows between each occurrence of the particular number.
Must be entered as an array formula using CtrlShiftEnter
You could add other statistics (like mean, standard deviation) the same way although the average could be calculated just by (lastrow-firstrow)/(count-1) e.g. for 5 it would be (8-3)/(4-1)=5/3.

Distribute value equally over weeks by start- and end-date

I want to distribute a certain value (D4:D6) equally over the week-numbers (E3:J3) by its start- and end-date (B4:C6), as shown in the example.
A formula/vba script should do the following things:
Check which week-number the start- and end-date has
Divide the value by the amount of weeks between start- and end-date
Place the values in the matching column in the same row
The example in text format to copy:
2017 2018
Start End Value 50 51 52 1 2 3
26.12.2017 04.01.2018 20 - - 10 10 - -
12.12.2017 24.12.2017 50 25 25 - - - -
11.12.2017 10.01.2018 60 12 12 12 12 12 -
Also glad about hints / ideas how single steps could be achieved.
Proof of Concept:
place the following formula in E4 and copy down and right
=IF(WEEKNUM($C4,21)-WEEKNUM($B4,21)<0,IF(OR(E$3>=WEEKNUM($B4,21),E$3<=WEEKNUM($C4,21)),$D4/IF(WEEKNUM($C4,21)-WEEKNUM($B4,21)<0,MAX(WEEKNUM(DATE(YEAR($B4),12,{28,29,30,31}),21))-WEEKNUM($B4,21)+WEEKNUM($C4,21)+1,WEEKNUM($C4,21)-WEEKNUM($B4,21)+1),0),IF(AND(E$3>=WEEKNUM($B4,21),E$3<=WEEKNUM($C4,21)),$D4/IF(WEEKNUM($C4,21)-WEEKNUM($B4,21)<0,MAX(WEEKNUM(DATE(YEAR($B4),12,{28,29,30,31}),21))-WEEKNUM($B4,21)+WEEKNUM($C4,21)+1,WEEKNUM($C4,21)-WEEKNUM($B4,21)+1),0))
Now this is a built up formula from multiple cells that I back substitute the formulas to wind up with the monstrosity above. The break down is as follows.
STEP 1
Find the start week number. Place the following in B8.
=WEEKNUM($B4,21)
STEP 2
Find the end week number. Place the following in C8.
=WEEKNUM($C4,21)
STEP 3
Determine the maximum number of weeks in a year. Thanks to Ron Rosenfeld for this formula. Place the following in D8.
=MAX(WEEKNUM(DATE(YEAR($B4),12,{28,29,30,31}),21))
STEP 4
Determine if the week is in the same year or the following year. Place the following in E8.
=C8-B8
STEP 5
Determine the number of weeks. Place the following in F8.
=IF(E8<0,D8-B8+C8+1,C8-B8+1)
STEP 6
Average the value for each week. Place the following in G8.
=D4/F8
STEP 7
Determine if the average value belongs to a date header or the value of 0 (if you want an actual dash and not just formatting 0 as a dash then change 0 to -. Place the following formula in H8.
=IF($E8<0,IF(OR(E$3>=$B8,E$3<=$C8),$G8,0),IF(AND(E$3>=$B8,E$3<=$C8),$G8,0))
Copy the H8 formula to the right and down as required.
Caveat: Will work for a 1 year spread in work weeks. I have serious doubts that it would work over multi year start and end week.
Layout of steps

sports scoring in multiple phases in excel

I have a question about excel.
There is a sports tournament with multiple phases. And the results page looks something like this:
rank phase1 phase2
1 TOM ALBERT
2 MATT TOM
3 ROBIN MATT
The first place gets 5 points, second 3 and third 1 points.
So the summary I would like to get is like this
rank name phase1 phase2 total
1 TOM 5 3 8
2 ALBERT 0 5 5
3 MATT 3 1 4
4 ROBIN 1 0 1
I cant figure out how to generate it simply, so if I copy-paste the results from phase3 to somewhere in my excel sheet, the summary page would also update.
If you can support me with advice or just a working template, I would be thankful!
Thank you for your time!
I've done you a basic example below...just list all 50 players in the summary page and copy the formula down as it is - as per the question it only records a value for the top 3 places, hope this helps if not please let me know :)
Example file here
Assuming the structure you defined and that when you paste phase 3 it will have its header ("phase3") on the same row as the other results, you could have the following formula on your Table 2:
{=SUM(IF(IFERROR(MATCH($B2,INDIRECT("Sheet1!"&CHAR(64+MATCH(C$1,Sheet1!$1:$1,0))&":"&CHAR(64+MATCH(C$1,Sheet1!$1:$1,0))),0)-1,0)={1,2,3},{5,3,1},0))}
Note: entered as Array formula: CTRL + SHIFT + ENTER
Formula uses the Table 2 headers ("phase1","phase2", etc.) and the players names to find the results for each phase. It then uses the predefined arrays that determine points given per position. The final sum is to bring the result that are in array (other values in array are 0) into single value.
Total would sum results per player.
Under the rank cells you would place the following formula:
=RANK(F2,$F:$F)
Which would provide you the rank of each player (Column F containing the totals).
Note that this would not sort your rank automatically but you could easily do this with Sorting or Autofilter. Hope this helps. Cheers.

Calculating days since an event in Excel

I am working with a weather data set. I am particularly interested in two columns which are cumulative precipitation and a date. My question is a simple one, though I am struggling to figure out the solution. Essentially I am wanting to determine days since precipitation. An example of the data is as follows:
WEATHER DATA
Pr Date
40 8/8/2013
40 8/8/2013
40 8/9/2013
40 8/9/2013
41 8/10/2013
41 8/10/2013
In this example, if I know the last day it rained was 8/7, then 8/8 would have a value of 1 (days since precipitation), 8/9 would be 2, and 8/10 would go back to 0. I have multiple dates because of hourly recordings (I trimmed it down for this post). I've been trying to figure it out with conditional if|then statements, but I'm thinking VBA may be more appropriate here. Any help or insight would be greatly appreciated.
Assuming cell C2 to be equal 1 (or start where you wish by adjusting the C2 value), the formula below works in the example you provided. Type in C3:
=IF(A3<>A2,0,IF(B3=B2,C2,1+C2))
Drag the formula down. Explanation:
If precipitation from time i+next is different from i it comes back to zero --> there was rain.
If time i+next is equal i, then it compares the date d+next with d.
If they are equal hold the number of days without rain from previous cell.
If they are not, add 1 day* to the value inside previous cell.
*I'm assuming you have consecutive days from the following sentence:
I have multiple dates because of hourly recordings

Calculating cited half-life for articles in Excel

Per Ana Andres, "[t]he cited half-life is the number of years, counting back from the current year, that account for 50 per cent of the total citations received by the journal in the current year."
I am trying to calculate this using a formula in Excel. Assume I have data as follows:
2008 2009 2010 2011 Total
0 4 1 3 8
The article was published in 2008, the current year is 2011. In this case the cited half-life is 2, since you have to go back to 2010 to get (1+3) 4 (i.e. 50% of 8) citations.
How can I write a formula in Excel that calculates the half-life in this manner using data structured as above (i.e. each column is one year)?
Paste your values as you have in range A1:E2 and then use the array formula below. You apply array formula by pasting it into a cell and pressing left ctrl + left shift + enter then when yiu select the cell with formula the formula will be shown as if it was in curly brackets i.e. {=max...}.
=MAX(IF(MMULT(((A1:D1)>=TRANSPOSE(A1:D1))*A2:D2,ROW(INDIRECT("a1:a"&D1-A1+1))*0+1)>SUM(A2:D2)/2,TRANSPOSE(A1:D1)))
Briefly
1) creates vector of 1s of a length equal to the number of years
ROW(INDIRECT("a1:a"&D1-A1+1))*0+1
2) provides the vector of years to pic from
TRANSPOSE(A1:D1)
3) provides matrix to calculate cumulative sum
(A1:D1)>=TRANSPOSE(A1:D1))*A2:D2
EDIT: I have modified the formula a bit as before it had problems in cases when the half of score was not achievable in any of the years and solved a bit different problem (it was latd whe I published my answer). I also added description how to use an array formula. Please let me know have it worked.
EDIT2: there was unneccessary space afer SUM which caused #VALUE, it was automatically enetered by spellchecker on my tablet.
You can get it with an auxilary row and the countif() function like this
A B C D E
1 2008 =A1+1 =B1+1 =C1+1 Total
2 0 4 1 3 =SUM(A2:D2)
3 =B3+A2 =C3+B2 =D3+C2 =D2-E2/2 =COUNTIF(A3:D3;"<=0")
I don't know a solution without such an xtra row.

Resources