Trying to apply an equation to the rows of a table of data but can't get it to work 100%