Excel Formula

I have a a spreadsheet where I am calculating elapsed time of calls.  I have one cell called Service avaiable date and time, cell AX, and another called IM Engaged date and time, cell AR.  Here are the scenarios I can run into:

Scenario #1
Service availble date, AX, can be null.  In this case the result should be 0:00:00

Scenario #2
IM Engaged date,cell AR, 07/16/2014 18:04 is greater then the service availble date, cell AX, 07/16/2014 17:35.  Result should be 0:00:00

Scenario #3
Service availble date,cell AX, is greater, 07/16/2014 18:04 then IM Enaged date,cell AR, 07/16/2014 17:35.  Result should be 0:29:00.

I tried a nested if formula, =IF(AX283="",0,IF(AR283>AX283,0,AX283-AR283) with no success.  What am I missing here?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I've seen cases where empty cells are not "" so that could be your problem here.  One way to solve that is to append "" in the test:

=IF(AX283 & ""="", ...

or you could try ISBLANK:

=IF(ISBLANK(AX283), ...
Rrave26Author Commented:
Ok, here is my formula:  =IF(ISBLANK(AX276),0,IF(AR276>AX276,0,AX276-AR276)).  Tried that and I get an Value error message.  Cell AX is null so I should get a value of 0 correct?
Ken ButtersCommented:
Point of clarification...

You are checking AR283>AX283.

The answer to whether one value is greater than another is true/false, will depend to a large extent on the data in the cell.   Is the data in your AR/AX cells formatted as date/time values or are they formatted as text values?

If they are formatted as text, you might be determining greater than or less than in terms of alphabetical order, rather than date/time order.

In addition if the cells are formatted as text... when you subtract the values... that will result in an error.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Rrave26Author Commented:
They are formatted as date time values.  They are all formated as mm/dd/yyyy h:mm.
Ken ButtersCommented:
if you put these formulas in some unused cells... what displays for each?

Rrave26Author Commented:
Here are my results

=ISBLANK(AX276)  False
=AR276>AX276 False
=AX276-AR276  #VALUE
Ken ButtersCommented:
=AX276-AR276  #VALUE

This line would indicate that both cells do not contain values that excel recognizes as a date/time field.

Can you post back the results for these formulas? -- trying to figure which cell or cells do not contain dates (at least which ones Excel not recognize as dates).

=IF(NOT(ISERROR(DATEVALUE(TEXT(AR276,"mm/dd/yyyy")))),"valid date","invalid date")
=IF(NOT(ISERROR(DATEVALUE(TEXT(AX276,"mm/dd/yyyy")))),"valid date","invalid date")

In the scenario you are looking at for AR276, AX276 do you expect isblank(AX276) to return true?

(This might be easier to debug if you are able to post an example of your workbook that contanis the error).
=ISBLANK(AX276)  False

What do you see in AX276?
And what is the formula in AX276?  For formulas, Excel may interpret a "blank" as zero (0)
Rrave26Author Commented:
Here are the results:

=IF(NOT(ISERROR(DATEVALUE(TEXT(AR276,"mm/dd/yyyy")))),"valid date","invalid date")  "Valid"
=IF(NOT(ISERROR(DATEVALUE(TEXT(AX276,"mm/dd/yyyy")))),"valid date","invalid date")  "INvalid"

For the scenario with AR276, AX276 I did expect isblank(AX276) to return true.  But now I'm thinking that a "" doesn't return a value.  

I have attached my spreadsheet for review.  I am looking at the IM Raw Data tab.
Ken ButtersCommented:
Try this: (just changing the first If statement test to AX276=""


The problem is... AX276 is not blank, because it contains a formula.  --- Even though the result of the formula is a blank.

Using the above format, you are specifically checking to see if a result of the formula is blank, rather than the cell  being blank.  (slightly different nuance).

Note... this looks very close to the formula in your original post that you already tried... only difference I can see, is that you were missing a trailing parenthesis.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rrave26Author Commented:
This fixed my issue.  Thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.