?
Solved

time formatting in formula

Posted on 2014-01-10
6
Medium Priority
?
335 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 600 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 34

Assisted Solution

by:Rob Henson
Rob Henson earned 600 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 800 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
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 

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 34

Assisted Solution

by:Rob Henson
Rob Henson earned 600 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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

755 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