View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default Min / Max together

"KristyAlison"
I am trying to create a cell (T5) that refers to another cell (S5) that
contains a value / number, but I don't want the T5 value to exceed 60,
at the same time not fall below 0. I know the functions of =MIN(60, and
=MAX(0, . But is it possible to have both work together to achieve
what I want?


Perhaps:

=MIN(60,MAX(0,S5))


"KristyAlison"
What happens is, the Excel has a check out date (Cell A), and a check in
date (Cell B). If books are returned exceeding 30 days (Cell B - Cell
A), this would be reflected in Cell C on showing the number of days it's
been overdue. A fine would also be calculated in Cell D, $1 is charged
for every day overdue, with a maximum of $60 that we are allowed to
collect by policy.

The problem is here, at times when books are still not returned over 60
days, (say 61 days), I want the cell to show a maximum of 60


If A1 is the check-out date, B1 is the check-in date and C1 is the daily
charge:

=C1*MIN(60,MAX(0,B1-A1-30))

If B1-A1 does not exceed 30, MAX returns 0, and MIN returns 0. So =C1*0
returns 0.

If B1-A1 is more than 30 but does not exceed 60, MAX returns B1-A1, and MIN
returns B1-A1. So =C1*(B1-A1) is $1 per day if C1=1.

If B1-A1 is more than 60, MAX returns B1-A1, but MIN returns 60. S0 =C1*60
returns $60 if C1=1, the maximum charge.