There is neither a special Excel formula nor a special VBA formula that will do what you want. The solution requires an algorithm, data structures and business logic.
The business logic would have to be defined first, as we have no way of knowing whether this is an ad hoc audit (where column G starts as blank and the goal is to "reconcile" the ledger), or if this is an on-going book of accounts.
If it is an audit, the algorithm might be simpler: just sort by Customer and Date and, for each customer, build a list of voucher strings until done. A couple of arrays and several pointers might be the data structures.
If, however, this is an on-going book of accounts, you need a more sophisticated algorithm and more complex data structures. For instance, when entries are made on 6-Jan, the value of G2 would only be 105. On the next day, 7-Jan, the algorithm would have to know that the payment would have to first be applied to G2 and the remainder to G4.