The answer is fairly straight forward add the total lengths up for a section D1 etc with regard to the reinforcement bar diameter.
Big problem is its not a table so need to get the text values and would have to sort and other stuff to make it work. A big task.
It would be much easier if take step back and make a table first.
Agree use excel can do sort of rows D1 using bar dia, then count, repeat D2.