As a teacher, I really hope you’re not keeping a spreadsheet of “very bad” results from students. Just labeling it that way worries me. I don’t know if this is behavioral or academic but either way surely there are other ways to keep track of their progress.
Your mood period function is very complex. It can be simplified. As it is, it seems that you are trying to find a time when the Student ID equals the Class Hour, which won’t ever happen.
Can you give a detailed, clear example of the input (which you’ve shown) and the search process? Just an algorithm… what are the steps for that?
For example:
Given a student ID, find the rows with that ID
For each row that matches that student ID, add up the “Bad” column values.
etc.
Because if all you need to do is to display 12 for the first student ID shown, you can achieve that with a VLOOKUP (search the forums). That can be as simple as using the find first occurrence of block to determine the row # and then using that result to get the value of the “Bad” column.
oh no worries! this is a mood tracker, so the “very bad” in this case would be that they’re in a “very bad” mood.
this is the example i’ve written in psuedocode, which is as clear as i can make it:
for each item in the column of student ids
if the student id in the column matches the student id of the logged in student
then do: for each item in the column of class hours
if the class hour is equal to the current hour of the day
display each number from bad, good, okay, very bad, and very good
break out of the loop
Display the value of the “Bad” column for the logged in student at the current time (hour)
And then for each other column (“Good”, “Okay”, etc.)?
The way I would do that is to Find the First Occurrence of app variable Student ID in column “Student ID” of the data source (that will return the row # with Class Hour “1st”) and then add [current hour minus one] to that value. Use that number as the row id to get the row object from the data source. Then get each property (column name) from the row object.