If Statement Based On Time Of Day
Mar 3, 2014I am looking to modify the formula below. Rather than specify the time "TIME(20,55,0)", I am looking to pull the time from another cell within the spreadsheet.
=IF(B6="","",IF(E7-INT(E7)
I am looking to modify the formula below. Rather than specify the time "TIME(20,55,0)", I am looking to pull the time from another cell within the spreadsheet.
=IF(B6="","",IF(E7-INT(E7)
An average of data collected over time is needed for each hour of the day, as well as a daily average during a specific time range (9a to 9p).
To calculate the average for the day, I'm trying to an IF statement that will calculate the average based on whether the time of the day is 9:00PM or 21:00... format is in 24hr.
So, I try to use the Time comparison for the logical test, and come up with my IF statement being False.
Column B has the Time for the date in question (Col A is date)
Column AN is the Daily Average Column
Column AK is the Modified Temp. Column
AN47 has the following formula:
=if(B47="21:00:00",AVERAGE(AK2:AK47)-50)
The Value_if_False I put "" but for the purpose of finding out if the formula's working or not, I leave it blank to tell me FALSE..
I know it's coming up with false because I'm comparing a Date/Time format to a Text format in the logical test.... Is there anyway around this? I'm sure it's an easy fix, and I'm making it too difficult.
Column A : Date & time ( 23 march 2011 14:35 )
In column B: I want the formula to look at column A and return three possible asnswers.
If the time is between 06:00 to 13:59 = AM shift
If the time is between 14:00 to 21:59 = PM Shift
If the time is between 22:00 to 06:00 = Night Shift.
Remember there is a dat attached to the time. I do not want to split the date & time.
Trying to write an if statement giving a simple value of 1 if a time is outside of weekday hours 8am to 9pm. Cell formatted as (6/3/17 2:15 PM). Function should report "0" value as this is a Tuesday between 8am and 9pm.
A cell formatted as (6/3/14 7:54 AM) should result in "0" value.
I'm trying to write an if statement to find the elapsed time. I want it to work so that if a time wasn't recorded, it looks to the previously recorded time to find the time in-between.
Here's what I have so far:
=IF($D18="",($F18-$N17)*1440,IF($N17="",($F18-$L17)*1440,IF($L17="",($F18-$J17)*1440,($F18-$D18)*1440)))
The problem I have when testing this formula is that D18 is not blank, so it should calculate (F18-D18)*1440. But it's not.. it's calculating (F18-N17)*1440. Here's a preview of my spreadsheet.
Sheet1 *ABCDEFGHIJKLMN15Major EventMajor Event Clock TimePUSHPush trashSPREADSpread trashOUT FWDOut of cell fwdREVReverseOUT REVOut of cell revDelayDelay1617************0.000*18**0.00010:03:17 56975643.55710:03:33 0.42710:03:59 0.17610:04:10 0.15610:04:19 ####*19**-1.02810:04:53 0.79910:05:07 0.14210:05:15 0.21110:05:28 ######*####*20**######10:05:38 56975645.84110:05:50 ######*0.19510:06:02 ######*####*21**######*56975646.19510:06:12 0.15410:06:21 ######*0.000*0.000*Spreadsheet FormulasCellFormulaM17=(N17-L17)*1440C18=IF($N17="",($D17-$L17)*1440,($D17-$N17)*1440)E18=IF($D18="",($F18-$N17)*1440,IF($N17="",($F18-$L17)*1440,IF($L17="",($F18-$J17)*1440,($F18-$D18)*1440)))G18=IF($F18="","",($H18-$F18)*1440)I18=IF($H18="",($J18-$F18)*1440,IF($F18="",($J18-$N17)*1440,($J18-$H18)*1440))K18=IF($J18="",($L18-$D18)*1440,IF($D18="",($L18-$N17)*1440,($L18-$J18)*1440))M18=IF($L18="",($N18-$J18)*1440,IF($J18="",($N18-$H18)
I am trying to build an if statement to test variables that are in time format and then perform a calculation.
I was able to get an example working if I convert the start times to integers rather than time values. However, the data won't be provided to me as integers.
So, I need a nested if statement (using "and") that will test for two situations using cells in time format or I need to write a macro to convert the time data to integer format. I've been working on the former most of the day and have hit a brick wall.
I get an application defined or object defined error at the select statement 1004...I know I know I shouldn't be selecting in code so I'll fix that but why can't I set the range?
NumRows = Sheets("Timelines").Rows.Count
LastColumn = Sheets("Timelines").Range("A1").End(xlToRight).Column
LastRow = Sheets("Timelines").Range("A" & NumRows).End(xlUp).Row
Sheets("Timelines").Range(Cells(1, 1), Cells(LastRow, LastColumn)).Select
TIA, Charlie Brown.
Consider this code:
'light eligibility
Dim facb As String
Dim sunset As Variant
[color=green]' check if facility has lights[color]
facb = WorksheetFunction.VLookup(RID, ds, 10, False) 'find facility code
If WorksheetFunction.VLookup(facb, fac, 6, False) = "Y" Then 'facility has lights
sunset = WorksheetFunction.VLookup(tempws.Range("A9"), sun, 2, False) 'lookup the sunset time based on the record's date
[Code] ......
This code checks the need for lights at a facility.
It first checks to see if the facility even has lights by cross-referencing a value in the record with a facilities database.
If it has lights, it then checks to see if they are needed. If the rental goes past the sunset time, then it needs lights. Sunset is determined by cross-referencing the date value in sheet1! A9, with the sunset database.
If it needs lights, variable lghtson is calculated equal to "sunset"-30 minutes.
As I step through this code:
WorksheetFunction.VLookup(facb, fac, 6, False) = "Y" Facility has lights.
Check to see if lights are needed.
sunset = WorksheetFunction.VLookup(tempws.Range("A9"), sun, 2, False)
sunset=0.879166666666667 which is 9:06PM. This is a proper value from the lookup.
If rental_end.value > sunset Then
rental_end (value from textbox) = "9:30 pm" , sunset=0.879166666666667. This is true, and Excel accepts it as true ...
lghtson = sunset - 0.5
0.379166666666667 = 0.879166666666667 - 0.5 (9:06 AM)
This is not the value I was looking for. I was looking for 8:34PM (0.856944444444444)
I know the title is a bit vague, but I cant think how else to word it!
I have a sheet (attached) which works out hours worked, and if the amount is under a specified target, it counts how much time is owed. The problem occurs when someone works more hours than the specified target.
I guess I need an IF formula of some kind, to say if the figure is over the target, to put zero in the hours owed column.
I have a large dataset where the first column is date and time i.e. "20/01/2005 03:41:06" and I want to delete certain rows based on the times. I have already tried playing about with macro's but failed fairly spectacularly so far. I have code from someone else to delete cells if the value equals a certain time but this doesn't work as the cell contains the date too.
I have already recorded one macro to reformat the data to as the software return 10 timestamped samples per hour and I want 8 i.e. every three hours so there is constant separation for statistical purposes. Both the macros are shown below so you can see what I have.
Ideally I would like to replace the line - If (r.Cells(n, 1) = TimeValue("22:41:06")) ............ - with one that reads - If (r.Cells(n, 1) CONTAINS TimeValue........ - but I don't know if that is possible? If not is there a way to separate the time from the date into 2 columns and then I can delete rows based on the time column using the code below? .......
Is it possible to use an IF statement based on Dec 31 - of any given year? If Cell B22 contains Dec 31 (year doesn't matter), I need to subtract 1 day from the date in Cell F2. This only pertains to Dec 31. If any other date of the year is in B22, no calculation should take place.
View 3 Replies View RelatedI am replicating a Matlab program which calculates tide levels at different times of day. I need to replicate it in excel to speed up data analysis and I am nearly there.
what happens is I need to apply a time offset to the time of high tide at port a based on the time of day, so if it is:
between 00:00 and 06:00 the high tide at port b is 81.6 minutes after the peak at port a
between 06:00 and 12:00 the high tide at port b is 74.56 minutes after the peak at port a
between 12:00 and 18:00 the high tide at port b is 81.75 minutes after the peak at port a
between 06:00 and 12:00 the high tide at port b is 79minutes after the peak at port a
I tried this formula, where CO2 has the time/date of the high tide at port a:
=IF(CO2<0.75,IF(CO2<0.5,IF(CO2<0.25,CL2+(81.6/(24*60)),CL2+(74.56/24*60)),CL2+(81.75/(24*60))),CL2+(79/(24*60)))
The problem is the high tide on 07/01/2005 07:45 is read as 38359.32 rather than 0.32 - is there any easy way to tell excel I'm only interested in the time not the date? I have this spreadsheet setup now to do all the other bits required and i is just the timing that is a problem.
Is there any way to do an IF statement that is based on the format of another cell. For example
View 3 Replies View RelatedIm trying to put a IF statement together to use the in between function.
I have a table (days) from 1 to 5 ie 21
I have a column of aged purchase orders and im trying to do a IF statement based on the table.
I have a data of 10 rows and 6 columns, if i delete the data in column 1, I want the entire row 1 to get deleted and this I want using IF Statement.
View 2 Replies View RelatedI am looking for a way to say
IF A2>9 then B2 returns bronze
IF A2>24 then B2 returns Silver
IF A2> 49 then B2 returns Gold
IF A2>99 then B2 returns Platinum
If I have any value in cell A1 then the cell should show 1 if true or nothing if false. I have managed this via
View 3 Replies View RelatedG5 - can contain True or false
G6 - contains text but the if is on the basis of this cell being "Hand Delivered" or not
I have tried the following to illustrate what I after:
I have a validation list list in column E "Check, Charge, Credit Card, Other". in another column i have what i thought was a straight forward IF statement: =if(E3="Check",9999,"[ ]")
It does not recognize "Check" as the condition. Is there a tweak i can do to get it recognize the data validation.
I am working in cell T3 of 'workbook A'.
I want to lookup a value from cell C4 in 'workbook B' if the value in cell G3 of 'workbook A' equals "Yes". If the value of cell G3 in 'Workbook A' equals "No" I need the value to be 0.
Is it possible to have a If statement based on the cells text color.
ie
If(color of A2=RED,1,2)
So if Apple text was colored red the result woud be 1
If the Apple text was black the result would be 2
I want to copy a row based on a certain condition. I have 700 rows of data on sheet 1. If Cells in column A contain an X, copy row A# to sheet 2. If there are more than cell that has an X copy all of the rows, naturally. Can this be done with a simple conditional statement, or am I going to need to generate an array, then write that array to sheet 2?
View 4 Replies View RelatedI have created a checklist using "Marlett" checkboxes. I have the names of choices in column B the Checkboxes in column C. In another sheet I want to populate only the names of the choices chosen without any of the spaces that a traditional if statement would populate if it was copied down a column.
View 3 Replies View RelatedTwo part question:
1. How do I structure an IF statement based on a specific cell color (e.g. if a cell is yellow, then perform function x)
2. How do I know what color is what? Is there a pantone reference? A color "name" that excel uses?
I'm having a bit of trouble with a macro designed to read the length text in a cell and if it = a certain length then perform an action (in this case Text to column)
Here is a small sample of the data I'm working with:
Tue 02/11/2014
LastBootUpTime
20140211082244.222441+000 <<
Tue 02/11/2014
LastBootUpTime
20140211082244.222441+000 <<
Tue 02/11/2014
LastBootUpTime
20140211082244.222441+000 <<
Tue 02/11/2014
LastBootUpTime
20140211082244.222441+000 <<
Tue 02/11/2014
LastBootUpTime
Tue 02/11/2014
LastBootUpTime
20140211082244.222441+000 <<
*End Sample*
The text length I want it to perform the action on is highlighted with "<<" if the length of text does not meet the required number then I want the statement to skip and move onto the next one.
I have the text to column code already done with relative references however the long text string I want the statement activated on is not always present which means that the pattern (0,3) is not always consistent.
I was trying to use an if statement to produce results based on 2 cells. The number in the 1st cell can be the number 1 to 5, but each number has critera with it. Say the cell is A1 and i enter the number 1. Then i want to check the value of Cell A5, if this is less than 40 then the cell A10 should read 250 and if A5 was over 40 then it should read 285. struggled to get a formula properly to work.
Here are the values for each number: A1 = 1 with cell A5
I am trying to pull certain members loads from our global design force spreadsheet and because of the naming convention we used for our structural members the 2nd to last character is unique to what I am looking for. I am trying to get a simple condition statement that will display the load only if the 2nd to last character of the name of the element is satisfied.
For Example, if "T" is what I am looking for then :
EDT4 will be true and give me the value accordingly
D10T1 Will also be true and return me the value
D10B2 Will not be true
I know how to use the Mid() and right() function, but I need to check the 2nd from the right.
I am trying to get an IF Statement created based off a checkbox answer.
I have a cell reference C2 from Checkbox that is answer Y.
If "Y" I want to calculate *0.005+0,0.03),0)*C4.
I need to skip the 1st & 2nd quarter after C4 before the calcautaion starts.
Then continuing no greater than .03 till the date changes.
I have tried to rearange this formula every way I can think of to get it to work like I want it to.
a correct formula for me to get this to calculate?
I've been working on this project to propagate certain products through multiple categories. I chose to use excel to assign multiple categories to each product. On sheet1 I have setup products (column a) and qualifiers in the following columns (color, model, etc). What I would like to achieve is for the user to select yes or no for each category column and and if yes then have the corresponding category breadcrumb string (from sheet2) inserted into one specific column in sheet3. As the user continues to select multiple "yes" from the category columns for that single product, those additional category breadcrumbs get inserted at the end of the list in sheet3.
View 9 Replies View RelatedOK i have put the membership cards on the same sheet as my raw data so to make the formulas easier. On the membership card i have under membership level i have the formula : =VLOOKUP($J$3,A:E,4,FALSE)
there is 3 types of level bronze, silver and gold
what i would like is if the level is gold after then an image to be placed in the cell rather than the word gold and a different image for silver and a different image for bronze.