If there is one rate for purchasing in blocks of 100, and another rate for lots of 1, then what you need is a formula that determines how many times 100 divides into the amount being purchased, and what the remainder is after you do the division. Let:

= number of shares

= number of whole lots (multiples of 100),

= number of individual lots

= commisision rate for whole lots (per hundred)

= commission rate for individual shares.
Then:
Commission =
where W and I can be calculated using the Excel functions:
W=floor(N/100, 1)
I = mod(N, 100)