Excel Ceiling and Max formulas

Copper Contributor

I need to create a spreadsheet to calculate how much change to make for my register. 

 

These are the columns I have: 

Column A: Currency denomination

Coulmn B: Current total in cash drawer.

Column C: Max amount we should have on hand in cash drawer.

Column D: Total change I need to make for the cash drawer.

 

I am using this formula: =MAX(0;CEILING(D8;10;1)) which works fine as long as the result is not a negative number. For instance, if I have $45 in quarters on hand the result for that formula results in an error. How can I get it to return a "0" if I have enough change and do not need any more?

 

 

A           B            C            D

1                        150

5                        145                     

10                        0

20                        0

50                        0

100                      0

Q                        40

D                        5

N                        8

P                        2

 

 

1 Reply
try:
=IFERROR(MAX(0;CEILING(D8;10;1)),0)

HTH