Transformed(PRow * (c - 1) + 1, 39) = "=MAX(X" & Sum & ",Y" & Sum & ")-INDIRECT(ADDRESS(ROW(AC" & Sum + 3 & "), 28+X" & Sum + 1 & "))+ INDIRECT(ADDRESS(ROW(AF" & Sum & "), 28+(X" & Sum + 1 & "+1)))"
Value 0 must be assigned to "Transformed(PRow * (c - 1) + 1, 39) " if the value is negative.
So...