In Calc vs. 4.3.1.2 how can I subtract from the next value above zero

I am setting up a mileage log where the weekends will be blank and I subtract for personal use on a daily basis. So for example A2-A1 = work mileage B1-A2 = personal use for that day. So on weekends I would have to skip the zero work mile days. How can I ignore zero value days and use the next cell that has a value that is a positive number? If A2=0 then use A3, if A3=0 then A4 and so on until it finds a positive number.

If you do not have to many empty cells you could possibly use an if-statement
=if (A2=0,if(a3=0,a4,a3),a2)
could be what you are looking for.

There might be some other formulas which could work as well. Please have a look at the sumif-formula.

I recommend you to also look into the guides, which you can download free of charge from: https://wiki.documentfoundation.org/Documentation/Publications

If nothing works please explain the structure of your spreadsheet in more details. Ideally attach it to the question. Be careful about the content this is a public forum.