Solved

time formatting in formula

Posted on 2014-01-10
6
290 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
Comment Utility
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 31

Assisted Solution

by:Rob Henson
Rob Henson earned 150 total points
Comment Utility
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
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:agwalsh
Comment Utility
@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 31

Assisted Solution

by:Rob Henson
Rob Henson earned 150 total points
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

6 Experts available now in Live!

Get 1:1 Help Now