View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
wabbleknee wabbleknee is offline
external usenet poster
 
Posts: 31
Default Baffeling IF statement

Tx again joeu2004. The procedure is much easier than you might expect. In a
medical environment, when a person is assessed with a stroke, certain things
must be completed within an hour. (The Golden Hour) C7 is the start of that
hour, entered simply as 12:30 c8, c9,c10,c11, c12,c13,c14,and finally c15 (1
hour from c7). c8 thru c14 are different intervals. Data is collected after
the fact and saved to analyze. Conditional formatting turns the elapsed time
RED if it exceeds the interval. Let me implement your suggested changes and
test it over the next week or so. Currently formatted as [h]:mm Intervals
are in minutes, 10, 20, 25, 45, 45, 45, 50 and finally 60. Currently I have
a "hidden helper column doing the rounding" and have tested it with 4 other
people, no problems as of yet! Have been doing Excel for 20+ years, learn
something new everyday. :o)

"joeu2004" wrote in message
...

On May 10, 4:31 pm, "wabbleknee" wrote:
I suspected that it was a rounding error, but dismissed it
because it was only happening with 0:50. Surely, there has
to be others that are not an exact match


It will depend on the hours of the day in A1 and B1, referring to your
original posting. It is difficult to predict. It is not difficult to
write a macro to determine "all" pairs that cause problems. But even
that might vary, depending on if/how you extract(?) the time from a
date/time specification. I'm suspicious because of your MOD usage
below.

No matter. The point is: __always__ expect that the match will
__not__ be exact and program accordingly.

wabbleknee wrote:
from a pure number
As the original formula was implemented,

[....]
sometimes the hours run across the midnight hour.
i.e 23:59 to 0:10 . So my formula looks like this:
C7 time is when the clock starts, c8 thru c15 are
time elapse (goal measurements) from the starting
point. =IF(C9="","",MOD(C9-$C$7,1)) then I am
checking the result against a maximum value
(<=goal) to see if we met that goal.


I must admit: it is unclear why you are using MOD and what
__exactly__ is in C7 and C9.

The best way to handle start/end times that might span across midnight
is to record date as well as time. You can also set the format to
display only time, if you wish. If you do this, elapsed time is
simply C9-C7 -- no need for MOD.

If you must record only time in C7 and C9, elapsed time is computed by
C9-C7+(C7C9) -- again, no need for MOD. Note that this assumes that
C7 and C9 are within 24 hours of each other.

In either case, I think TEXT is easier to use than ROUND in this
context. But I will demonstrate both.

=IF(C9="","",ROUND((C9-C7+(C7C9))*1440,0)/1440)

=IF(C9="","",--TEXT(C9-C7+(C7C9),"hh:mm"))

I would format using Custom [h]:mm as "good practice".

The [h] notation will display hours 24. But it appears you do not
expect that. So a Time option or Custom hh:mm might do just as well
for your purposes.

If that formula is in C10 and your goal is a constant in A1, you
should be able to write:

=IF(C10<=A1,"yes","no")

Alternatively, if your goal is 8 hours (e.g.), you could write any of
the following:

=IF(C10<=TIME(8,0,0),"yes","no")

=IF(C10<=--"08:00","yes","no")

The first form is preferred as "good practice".