Nice! Two ideas, Barbara:
1) Even if you'd wanted to keep the helping column (I'm not suggesting it), you could do it by just hiding it, either out to the right where no one would think to look or just making its column width 0. For my own use (I don't really like hidden columns, I like to be able to double check), I often color the whole sheet grey and then restore normal color for the non-helping columns I'm using at the left; it helps keep the eye focused away from the helping columns at the right. But for management types, hiding them may be better—and your idea of doing without helping columns entirely is probably better still, when possible.
2) When there is no data—no check-in time—the formula's result is 0, which your worksheet is displaying as "12:00 AM". Your solution is ingenious; I don't think I'd have thought of that. Pecoflyer's formula fixes it another way. But for my money it's probably simpler still to keep his original solution and use a formatting code that displays 0 values as either blanks, as his suggested "NA" or as anything else you choose.
If you're never made up your own formatting codes, they're not hard. Try this:
a) Examine the format of one of the tbl_Employee cells that displays that 0 value as "12:00 AM". I presume the format
Category is "Time" and the
Type is "1:30 PM".
b) Now click on "Custom" at the bottom of the
Category list; Excel shows you the format code for that standard setting. Yours might say "h:mm AM/PM;@"; I don't know why, but mine says "[$-409]h:mm AM/PM;@". In any case, make one small change: Add a semicolon to the end of the string.
c) Hm, wait a minute; mine claims that Microsoft Excel cannot use that format string. Ok, forget the fancy stuff (I didn't know why it wanted an ampersand in that position anyway) and change it to "h:mm AM/PM;-General;". I'll explain below.
d) Ok,
now click OK and look at the results. The cells that should be empty now appear to be.
This has the additional advantage of not needing to change Pecoflyer's original solution, without the IF function; I expect it's faster to run, as a result, but I haven't tested it to see.
---
So what did the pieces of that format string mean? Excel format strings come in four semicolon-delimited parts:
- Positive numbers
- Negative numbers
- Zero
- Character strings
Anything that isn't specified is assumed to use default display. So the original string that my Excel was using, "[$-409]h:mm AM/PM;@", went like this:
- If the value was positive, use "[$-409]h:mm AM/PM". I don't know what "$-409" means, but it happens that normally my Regional Settings call for military time, "hh:mm:ss"; I changed the format code in Excel for the purpose of this test, so maybe perhaps "[$-409]" is a reference to that. What normally goes inside the optional square brackets is something like "Red" or "Bold", to change the default font in such cases.
- The "@" seems to mean that if the value is negative, display it as a character string. I've never tried using that in the second position (only in the last), and it isn't clear to me what it could mean—especially as Excel itself rejected it as soon as I tried to use it myself. Above I had you change it to "General" (or "-General", either one), which is a sort of default-for-everything setting.
- There's no semicolon after the negative value, so zero and strings are displayed normally.
But by putting the semicolon at the end, I specified an empty string, "nothing", for the third value; so zeroes are displayed as blanks. If you want Pecoflyer's "NA" instead, just make the format string
Code:
h:mm AM/PM;-General;"NA"