Solved

time formatting in formula

Posted on 2014-01-10
6
309 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Outlook Free & Paid Tools
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

772 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