Solved

time formatting in formula

Posted on 2014-01-10
6
300 Views
Last Modified: 2014-01-14
hi Folks
I've created this formula...the idea being that if the status column shows less than 5 minutes and H3 is not the same as h2, it should show up as transient
=IF(AND(H3<>H2,TEXT([@Status],"[mm]:ss")<5),"transient","resident"). However when I copy down the formula, everything is showing as resident and I think it's to do with the 5 in my formula. I've formatted the status column as time.
How can I show my 5 as five minutes or is there something else?
Thanks as always..
0
Comment
Question by:agwalsh
6 Comments
 
LVL 3

Assisted Solution

by:Sreeram
Sreeram earned 150 total points
ID: 39770740
Try this

=IF(AND(H3<>H2,ROUND(C9*1440,0))<5),"transient","resident")

Enter the time in the Cell c9 in the format HH:MM
0
 
LVL 32

Assisted Solution

by:Rob Henson
Rob Henson earned 150 total points
ID: 39770766
It may help to give a quick explanation of how excel works with date and time.

Date = Integer count of days since 01/01/1900 giving a serial number eg today (10 Jan 2014) is 41649.

Time = decimal portion of a day, therefore 41649.5 would be 12:00 noon today; divisble into 24 hours or 1440 minutes (24 * 60) or 86400 seconds (24 * 60 * 60)

Thereby all values for time alone are less than 1, hence why all your items were less than 5.

I assume your [@Status] is because the data range is set to a table rather than a list so the corrected formula would be:

=IF(AND(H3<>H2,[@Status]<5/1440),"transient","resident")

Thanks
Rob H
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 200 total points
ID: 39772274
It's also possible to use this approach

=IF(AND(H3<>H2,[@Status]<"0:05"+0),"transient","resident")

...or you might find it simpler to use TIME function like this:

=IF(AND(H3<>H2,[@Status]<TIME(0,5,0)),"transient","resident")

regards, barry
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:agwalsh
ID: 39776167
@Kujumbio - tried your approach and I can see it's nearly there..Couple of questions though..

Your formula was:
=IF(AND(H3<>H2,ROUND(C9*1440,0))<5),"transient","resident")
simply because c9 wasn't a relevant cell

I adjusted it to:

=IF(AND(H4<>H3,ROUND([@Status]*1440,0)<5),"transient","resident").
Unfortunately this is still giving me "resident status"
I also formatted Status as "[HH]:mm" but I'm still getting all Residents.

Would the following have any impact? I've used =TEXT(A3-A2,"[h]:mm:ss") to extract the Time Elapsed and =TEXT([@[Time Elapsed]],"[HH]:mm") to show Status..

I'm attaching a sample file to illustrate. Thanks for all your help. Much appreciated.
I've tried all your approaches as you can see in the file but reckon I'm missing something in my time formatting..
EE--If-on-time.xlsx
0
 
LVL 32

Assisted Solution

by:Rob Henson
Rob Henson earned 150 total points
ID: 39776253
Looks like the problem is because you are converting all time values to text.

Time Elapsed can just be =A3-A2, then format as "[h]:mm:ss"

What are you trying to achieve with status column? Currently it is just converting Time Elapsed to text but, with current formula, its already text.

Thanks
Rob
0
 

Author Closing Comment

by:agwalsh
ID: 39779769
Have awarded you all points because you all helped to the solution - which eventually I did as:
=IF(AND(H5=H4,[@[Time Elapsed]]>TIME(0,5,0)),"resident","transient")
I gave BarryHoudini best solution because his answer was the closest to what I eventually got working for me. But THANK YOU as always to all of you :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now