It adds up what each item needs across all branches and only then rounds the number of crafts up. One log makes 4 planks; if you need 5, that is 2 logs and 3 planks left over. Leftovers show on the Materials tab and are reused by other items on your list before more raw material is requested.