See if this works for you. You can either insert the formula directly into the columns wherever there is a 0 or just create a separate column and then copy and paste values.

Excel example.xlsx