View Single Post
  #8   Report Post  
Roger Govier
 
Posts: n/a
Default need help with formula

Hi Bryan

With your calculated days being in K2
=MAX(0,K2-6)*17+MAX(0,K2-10)*33+MAX(0,K2-30)*50

Change cell ID holding days out to suit.

Regards

Roger Govier


Bryan J Bloom wrote:
ok very well done and thank you all. But now i need to break it down a little
further if possible. Like I posted earlier this is showing days out of
rail/ship yard. What Im calculating is if the trailer is out of the RR more
than 6 days. Then days 7,8,9 and 10 are to be multiplied by 17. Then days 11
through 30 are to be multiplied by 50 and 31 + multiplied by 100. So the
formula you gave did the multiplication but multiplied (e) by only the
integer amount not by a rising number(my fault late info) I'm trying to get
it so that
eg: the trailer has been out 40 days(e). The first six are not multiplied.
Days
7,8,9 and 10 (4 days) are multiplied by 17(68). Then days 11-30 (the next 20
days) are multiplied by 50(1000). Finally days 31+ (the last days 10) are
multiplied by 100(1000) to be added together with the others to make a total
of 2068.
Sorry for any confusion, was asked to get it one way then get told
another..lol
Thanks so much
Bryan Bloom


"Sloth" wrote:


To add or subtract dates, treat them as regular numbers. Dates are in fact
stored as the number of days from 1/0/1900 (1/1/1900 is stored as 1). You
can check this by entering a date and then formating the cell as a number.
When you subtract a date from another date the result "looks" like a date,
but it is not. You need to change the cell format to a number after entering
the formula.

Example
A1-D1: various dates
I1-I3: various integers
E1: =(A1-B1) + (C1-D1)
F1: =IF(E16,IF(E110,IF(E131,I3*E1,I2*E1),E1*I1),E1)

F1 outputs:
E1 if E1<6
E1*I1 if 6<E1<10
E1*I2 if 10<E1<31
E1*I3 if E131

Be sure to format E1 and F1 as numbers after entering the formulas.

"Bryan J Bloom" wrote:


I need to subtract 2 different sets of dates to get a total amount of days.
Eg: (a-b)+(c-d) = e
I then need to take the total (e) and multiply by 3 different integers if
the total (e) is greater than 6 days,10 days and 31days.
This helps me keep track how long my company trucks are out of a Rail/Ship
Yard.
I can't seem to get the dates to subtract and get an integer(regular
number). and I'm dead lost on the greater than stuff.
Of course the boss drops this on me on my first day.
Any help or comments will come highly appreciated.
Thank you