Formula to calculate the number of weeks that it takes for a score to interstect the predicted score

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
578
Office Version
  1. 365
Platform
  1. Windows
Hello,

I came up with a way of gauging student progress, and I’m trying to write a formula for that purpose, so I can test the method in larger scale to see if it’s any good at all. Here is what I do: I take each student’s week 1 score and subtract it from the week 5 score (e.g. 88-76), and so there is an improvement of 12 points over 5 weeks, or 2.4 points per week, for this example (table 1).

Now, the question I want to ask is, at any given week, how many weeks does it take for the student’s score to intersect the predicted score, which is the score of that week plus 2.4 x #weeks of passed? I calculated manually as shown in table 2, so for example, for week 1, it takes 2 weeks (table 3) for the score to intersect week3 score (i.e. 81 is greater than 76+2.4+2.4). And at week2, it takes 1 week for the score (81) to intersect the predicted score (80.4).

I need a formula that would calculate this without the need to make the extra table 2 of predictions.

Thanks for any input!!! :)


Table1:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Week1[/TD]
[TD]
Week2
[/TD]
[TD]<strike></strike>
Week3
[/TD]
[TD]<strike></strike>
Week4
[/TD]
[TD]<strike></strike>
Week5
[/TD]
[TD]<strike></strike>
Week6
[/TD]
[TD]<strike></strike>
Week7
[/TD]
[TD]<strike></strike>
Week8
[/TD]
[TD]<strike></strike>
Week9
[/TD]
[TD]<strike></strike>
Week10
<strike></strike>[/TD]
[/TR]
[TR]
[TD]Student1[/TD]
[TD]76[/TD]
[TD]78[/TD]
[TD]81[/TD]
[TD]79[/TD]
[TD]88[/TD]
[TD]86[/TD]
[TD]90[/TD]
[TD]83[/TD]
[TD]91[/TD]
[TD]95[/TD]
[/TR]
[TR]
[TD]etc.[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


<strike></strike>Table2 (predicted scores):
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Week1[/TD]
[TD]
Week2
[/TD]
[TD]<strike></strike>
Week3
[/TD]
[TD]<strike></strike>
Week4
[/TD]
[TD]<strike></strike>
Week5
[/TD]
[TD]<strike></strike>
Week6
[/TD]
[TD]<strike></strike>
Week7
[/TD]
[TD]<strike></strike>
Week8
[/TD]
[TD]<strike></strike>
Week9
[/TD]
[TD]<strike></strike>
Week10
<strike></strike>[/TD]
[/TR]
[TR]
[TD]W1pred.[/TD]
[TD][/TD]
[TD]78.4[/TD]
[TD]80.8[/TD]
[TD]83.2[/TD]
[TD]85.6[/TD]
[TD]88[/TD]
[TD]90.4[/TD]
[TD]92.8[/TD]
[TD]95.2[/TD]
[TD]97.6[/TD]
[/TR]
[TR]
[TD]
W2pred.
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD]80.4[/TD]
[TD]82.8[/TD]
[TD]85.2[/TD]
[TD]87.6[/TD]
[TD]90[/TD]
[TD]92.4[/TD]
[TD]94.8[/TD]
[TD]97.2[/TD]
[/TR]
[TR]
[TD]
W3pred.
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD]83.4[/TD]
[TD]85.8[/TD]
[TD]88.2[/TD]
[TD]90.6[/TD]
[TD]93[/TD]
[TD]95.4[/TD]
[TD]97.8[/TD]
[/TR]
[TR]
[TD]
W4pred.
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]81.4[/TD]
[TD]83.8[/TD]
[TD]86.2[/TD]
[TD]88.6[/TD]
[TD]91[/TD]
[TD]93.4[/TD]
[/TR]
[TR]
[TD]
W5pred.
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]90.4[/TD]
[TD]92.8[/TD]
[TD]95.2[/TD]
[TD]97.6[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]
W6pred.
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]88.4[/TD]
[TD]90.8[/TD]
[TD]93.2[/TD]
[TD]95.6[/TD]
[/TR]
[TR]
[TD]
W7pred.
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]92.4[/TD]
[TD]94.8[/TD]
[TD]97.2[/TD]
[/TR]
[TR]
[TD]
W8pred.
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]85.4[/TD]
[TD]87.8[/TD]
[/TR]
[TR]
[TD]
W9pred.
<strike></strike>[/TD]
[TD]<strike></strike>[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]93.4[/TD]
[/TR]
</tbody>[/TABLE]


Table3 (# of weeks taken for the actual score to intersect the predicted score):
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Week1[/TD]
[TD]
Week2
[/TD]
[TD]<strike></strike>
Week3
[/TD]
[TD]<strike></strike>
Week4
[/TD]
[TD]<strike></strike>
Week5
[/TD]
[TD]<strike></strike>
Week6
[/TD]
[TD]<strike></strike>
Week7
[/TD]
[TD]<strike></strike>
Week8
[/TD]
[TD]<strike></strike>
Week9
[/TD]
[TD]<strike></strike>
Week10
<strike></strike>[/TD]
[/TR]
[TR]
[TD]Student1[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]never[/TD]
[TD]1[/TD]
[TD]never[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]n/a[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Assuming that:
- the number of weeks is fixed to 10, and
- you have week numbers (1 to 10, without the "Week") in range B1:K1, and
- you have scores in range B2:K2,

try putting the following array formula (to be entered using Ctrl+Shift+Enter, not just Enter) in a cell and drag-copying it to the right as needed:

=IFERROR(MATCH(TRUE,OFFSET($B2,,B$1,,10-B$1)>=OFFSET($B2,,B$1-1)+(OFFSET($B2,,4)-$B2)/5*TRANSPOSE(ROW(INDIRECT((B$1+1)&":10"))-B$1),0),IF(AND(B$1>0,B$1<10),"never","n/a"))
 
Upvote 0
Wow, amazing! You are an absolute genius!!!

If you get a chance, could you please provide a brief explanantion of the formula as well?

Thanks a lot!
 
Upvote 0
You are welcome.

Here is a brief explanation:

The OFFSET($B2,,B$1,,10-B$1) part creates an array of actual student scores. Since we have 1 in cell B1, the array has 9 (i.e., 10-1) elements: 78,81,79,88,86,90,83,91,95.

The (OFFSET($B2,,4)-$B2)/5 part calculates the the score improvement per week over the first 5 weeks.

The OFFSET($B2,,B$1-1)+(OFFSET($B2,,4)-$B2)/5*TRANSPOSE(ROW(INDIRECT((B$1+1)&":10"))-B$1) part creates an array of predicted scores. For week 1 (1 in cell B1), it's 78.4,80.8,83,2,85.6,88.0,90.4,92,8,95.2,97.6.

The two arrays are then compared (actuals>=predictions) to return the following array: FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE.

Then, the MATCH(TRUE,... function looks for the first occurrence of TRUE and finds in in position 2 of 9. This 2 is your result for Week 1.

If the MATCH(TRUE,... function cannot find TRUE, it returns an error (#N/A), which is handled by the IFERROR(... function that returns "never" or "n/a", depending on the week number.

Hope this helps.
 
Upvote 0
Awesome! Really well-designed!!! I'm gonna digest it, and I'll post back if I have more questions. Thanks much!!!
 
Upvote 0
There is one part that I couldn't exactly figure out. I think that the
TRANSPOSE(ROW(INDIRECT((B$1+1)&":10"))-B$1
part is a counter mechanism to calculate how many times to add 2.4 (i.e. score improvement), is that right? But I couldn't figure out how it is doing the counting :) Thank you!
 
Upvote 0
You are right. Here is how it works:

We have 1 in cell B1, so
B$1+1 evaluates to 2
(B$1+1)&":10" evaluates to "2:10"
INDIRECT((B$1+1)&":10") evaluates to range 2:10 (i.e, rows 2 to 10)
ROW(INDIRECT((B$1+1)&":10")) evaluates to a vertical array of numbers {2;3;4;5;6;7;8;9;10}
ROW(INDIRECT((B$1+1)&":10"))-B$1 evaluates to a vertical array of numbers {1;2;3;4;5;6;7;8;9}. See *Note below.
TRANSPOSE(ROW(INDIRECT((B$1+1)&":10"))-B$1) evaluates to a horizontal array of {1,2,3,4,5,6,7,8,9}
(OFFSET($B2,,4)-$B2)/5*TRANSPOSE(ROW(INDIRECT((B$1+1)&":10"))-B$1) evaluates to a horizontal array of {2.4,4.8,7.2,9.6,12.0,14.4,16.8,19.2,21.6}
OFFSET($B2,,B$1-1)+(OFFSET($B2,,4)-$B2)/5*TRANSPOSE(ROW(INDIRECT((B$1+1)&":10"))-B$1) evaluates to a horizontal array of {78.4,80.8,83,2,85.6,88.0,90.4,92,8,95.2,97.6}

*Note: this could have been done in a simpler way: ROW(INDIRECT("1:"&(10-B$1)))
 
Upvote 0
I see. That's amazing! I have learned so much from your formula! Highly appreciated!

In the meantime, I was applying the formula to many of my score sheets, and it works so nicely!

Lastly, there is one issue that I encountered, which I hope you can help me with. Not sure why, but some of the scores have been entered backwards, meaning week10 is in the left, and week1 is rightmost. If not a big trouble, could you please make a variant of your formula for this kind of sheets? If it's too complicated, don't worry about it; I will try to flip the orientation of scores somehow. I tried to make one, but my brain gave up :) Thanks much!
 
Upvote 0
Assumptions for the "reverse-order" layout:
- the number of weeks is fixed to 10;
- you have week numbers (10 to 1, without the "Week") in range B1:K1;
- you have the corresponding actual scores in range B2:K2.

Try putting the following array formula (to be entered using Ctrl+Shift+Enter, not just Enter) in a cell and drag-copying it to the right as needed:

=IFERROR(LOOKUP(2,1/(TRANSPOSE(A2:$B2)>=B2+($G2-$K2)/5*(11-B$1-ROW(INDIRECT("1:"&(10-B$1))))),11-B$1-ROW(INDIRECT("1:"&(10-B$1)))),IF(AND(B$1>0,B$1<10),"never","n/a"))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top