'How can I compare a number to a previous highlighted number?

enter image description here

I'm stuck with few problems in google sheets. I have a solution to get the last number in a column

=ARRAYFORMULA(lookup(2,1/(A1:A20<>""),A1:A20))

but I'm not able to figure out how to solve the below scenarios. Any help would be greatly appreciated!

  1. If 7b is more than 3 points compared to the last highlighted (green) number in 7B, then show "true"
  2. If 7b or 5a is close to the last highlighted (green) number in B (ex: between a range of 1-3), then show "alert"
  3. If the last number entered was in 8a then enter c7 as "done"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source