View Single Post
  #3   Report Post  
Peter Rooney
 
Posts: n/a
Default need help with formula

Bryan,

Try this to test the value in C4

=IF(C431,C4*Factor31,IF(C410,C4*Factor10,IF(C46 ,C4*Factor6,0)))

Where Factor31 is the name given to cell C5, Factor10 is the name given to
cell C6 and Factor5 is the name given to cell C7. The ,0 at the end of the
formula tells it what to do if none of the three conditions tested for are
met. It couls just as easi;ly be a reference to a cell a name or a label e.g.
"None"

You could just put values in the formula instead of references to worksheet
name, but if you plan to copy the formula to a large number of cells, it's
harder to modify, as you'd have to change each one if the 6, 10 and 31
factors ever needed to change. This way, you only need to change the values
in the "Factor" cells.

No idea why you can't get an integer result, unless you're trying to
subtract today's date NOW() somewhere, which will always be a decimal, (apart
fro 00:00 midnight!) depending on where you are in the system clock. if this
is the case, try using INT(NOW()) in your formula, to retuen a whole number.

Don''t forget to test largest first - i.e. you want to test that the value
is greater than 31 before you test that it's greater than 10 or 6 etc)

Hope this helps.

Pete






"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