How To Lookup Data In A Cell Formatted As Time
Aug 11, 2006I'm trying to lookup data in a cell formatted as time, the array is also formatted as time but I continue to get the #N/A. Is there a certain format that I should use?
View 9 RepliesI'm trying to lookup data in a cell formatted as time, the array is also formatted as time but I continue to get the #N/A. Is there a certain format that I should use?
View 9 RepliesI'm trying to lookup data in a cell formatted as time, the array is also formatted as time but I continue to get the #N/A. Is there a certain format that I should use
View 6 Replies View RelatedI've written a script to read all the values in an excel worksheet in to an array. The cell types differ from General or Text to Custom - HH:MM When I look through the array the script has returned the correct value for most but for the cells that are of a custom type an "incorrect" value has been returned. For example a cell of type Custom HH:MM which is 10:23:00 in the worksheet appears as 0.432638888888889 in the array. Is there a way to get the script to return the correct value?
Below is an extract of the code I've used
If objWorksheet.Cells(i, "D") <> "" Then
If objWorksheet.Cells(i, "F") <> "" Then
arrCULDEV = Split(objWorksheet.Cells(i, "F"), ":")
Redim Preserve arrSheetInfo(x)
arrSheetInfo(x) = arrCULDEV(0) & "," & arrCULDEV(1)
x = x + 1
i = i + 1
Else
i = i + 1
End If
End If
I am trying to get a single cell to display the following:
Last Updated: 3/18/2008 15:08 (GMT+2)
Entering =NOW() in a cell displays the date and time as required.
But entering ="Last Updated: "&NOW()&" (GMT+2)" displays the date and time as a serial number. Formatting the cell to Date does not change the serial number to date and time format.
The only way I have found to get the desired result is to use =NOW() in another cell (F13), format that cell to general to get the date/time serial number, then use ="Last Updated: "&TEXT(F13,"m/d/yyyy h:mm ")&" (GMT+2)" in the required destination cell.
As I said this works, but it strikes me as an inefficient method. Is there a formula I can enter or formatting I can apply to get the desired result without using an addition cell?
The result needs to be in a single cell. Splitting text and date/time into 3 adjacent cells will not work with my worksheet setup.
The solution below to look up numbers in an array formatted as 10 characters as text.
=VLOOKUP(TEXT(A1,"0000000000"),LOOKUPTABLE,2,FALSE)
This has worked well except now I have received the data and the text I want to lookup has been reformatted (previously leading zeros) to the number with trailing spaces, still a total of 10 characters but the above formula no longer works. Is there an easier workaround other than using "Find" to locate the position of the first space.
I am trying to calculate the difference in time between two cells and if the difference is >= 8 Hours the result is 8 hours - 1 Hour if the result is less than 8 hours then the result stands. I have the following, but it returns 8 always.
The two cells are formatted as hh:mm
H6 = 06:30 & G6 = 14:30
=IF(((H6-G6)>=8),"((H6-G6)-1)","(H6-G6))")
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 need to calculate the difference in Years, Months and Days between:
Date 1 = TODAY()
Date 2 = 4 years after a date in cell A1, which will always be earlier than today's date
(A bit of backround - I have certain risk management procedures that have a lifespan of 4 years. I want to calculate the time between now and 4 years after the date the procedure was completed, essentially to see how long before they have to be redone).
So far I have:
=DATEDIF(A1+4,TODAY(),"y")&"y "&DATEDIF(A1,TODAY(),"ym")&"m "&DATEDIF(A1,TODAY(),"md")&"d"
But that returns #NUM!.
Removing the +4 obviously just calculated the difference between the date in A1 and today, but I need the date in A1 PLUS 4 years and today.
I have also tried:
=(DATE(YEAR(A1)+4,MONTH(A1),DAY(A1))-TODAY())/365.25
which works in theory, however:
a) no consideration for leap years
b) does not return nY, nM, nD - only the decimal.
However I would be happy to use this method if I could convert it to Years Months Days.
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 have a cell that calculates an etch time, eg 41.88. The cell is formatted to give me whole numbers and quarters only so that the operators input is made easier, in this case 42.
When I use a macro to copy this to another worksheet, although it appears as 42, the actual cell data is 41.88. Anyway I can get the actual cell data to be 42?
I have data which needs to be formatted with a thousand separator as below.
400.00
1,000.00
250,000.00
How can I do this without it displaying as below
,400.00
I do not want it reflected in the case of hundreds.
I have a graph that pulls data from a toggled list. Values include currency, percentages and general numbers. The data is set up as text to report as currency, percentages and general numbers. Is it possible to have a graph read these text values?
View 1 Replies View RelatedReceive worksheets with data in different layouts that needs to be moved into formatted worksheet with unique layout and field size to import in to Access database.
Example of formatted table layout ....
I ran a very simple code that conditionally formatted red any cell sum greater than 12. The macro worked all the way to the end - about 15k rows. After saving and re-opening file only the first 1603 lines had the formatting and the rest did not. Several attempts end with no change in results.
I did the programming in Office 97 but edited and ran it on Excel 2002.
I have a column who's content is determined via about 6 nested if statements from data on that row. That cell is then conditionally formatted to a certain color based on the text that is ultimately printed from the nested ifs (simply an extra visual legend for the text). All of this contributing info and about 1000 lines items make a very large and difficult to print page. What I am trying to do is a make a summary sheet that simply takes the index number of these 1000 rows and copies or links the conditional formatting of the mentioned cell onto this number on another sheet. I have already linked this status cell and put it adjacent to the index number which works well in that with two columns I can show the index and status but if I could combine the color of the status cell onto the index cell, it would be even better. I am pretty sure another conditional format for this summary sheet would not be possible or be extremely complex since the contents of the index cell I am conditionally formatting have no bearing on the conditions for the format. Was hoping there is some VBA magic that could simply mimic the conditional formatting from one cell and put it on another.
View 1 Replies View RelatedUsing 2007, I need to conditionally format a cell colour based on 5 other cell colours that have been conditionally formatted. The 5 other cells will be coloured either red or greem. What I want to do is have an overall status cell that would be show green if all of the other 5 cells were green, amber if 4 of the other cells were green and one was red and red if 3 or more cells are red.
View 4 Replies View RelatedI have a cell that I've formatted to dd/mmm/yy, It used to work, but now it doesn't. When I type in 1/2/03, the formatted cell shows 0-Jan-00, The formula bar shows =1/1/2. I seem to have a formula in the cell, but I can't get rid of it. I know it's most probably somethinmg I've done , but I don't know what. I've tried everything I know. I can't seem to re format the cell , and I can't delete the formatting in it. I'm stuffed.
View 9 Replies View RelatedI'm trying to link two different budgets into a third spreadsheet. The final step I'm attempting to accomplish is have an if-and statement reference just the month from a date-formatted cell. One of my departments tracks their budget on a daily basis, i.e.
11/2/2009, 11/3/2009, etc. rather than just 11/2009. I want the if-and statement to return the budget from all days in a given month so i can apply the formula to the whole year, broken down monthly too. I saw a question similar to this one but didn't see any responses so I'm not sure if it can be done.
I want to be able to "count" apples and oranges. Is there a way to record a particular text in a text formatted cell and count it. e.g. 10 cells, 3 say "apples", three say "oranges", 4 say "plums". I want excel to keep track of the three types of fruit when I change them and give me a running number of each.
View 2 Replies View RelatedI have a whole number in cell C2, but i am formatted it in Cell C3 to always have leading zeros combined with the number in Cell C2, where the result will be 8 digits long. example, my number in cell C2 = 572 but i need it formatted to be 00000572, but if the number was 19 it needs to be formatted to be 00000019 and so on.
View 2 Replies View RelatedI have a data entry field on a form that is formatted for percentages. Sometimes when i key in "10" it will correctly convert it to "10%" but other times it randomly converts it to "1000%". When the error occurs, I'm able to correct it by re entering the value a few times until it displays correctly as "10%".
View 2 Replies View RelatedPart of my work involves the transfer of thousands of lines of Excel data into FileMaker and then exporting this data to Word where it is finally formatted for publication. What I'd ideally like is to skip the FileMaker step and simply have it so that I import all the data from my Excel file into a Word document in one swoop. The problem is that the eventual export can't feature tables, it would be the icing on the cake for the data to remain as formatted, and the data needs to read line<space>line<space>, vertically.
Essentially, I need to know how to take this from Excel ..
this1.jpg
And turn it into this in Word ...
this2result.jpg
I am trying to use the vlookup function but the range of reference has that little green triangle in the corner and if I f2 each cell that triangle goes away and the vlookup function works great. Do you know what is going on here? And also, a quick way to convert all the cells with the green triangle to be without the triangle in a whole range? I don't want to have to go to each cell individually and f2. I've attached an example worksheet for reference to what I am describing. vlookup format.xlsx
View 2 Replies View RelatedI'm working on a sheet for our accounting section which has been in use for quite some time, which means, that I'm not supposed to change a hell of a lot in it since it's accounting and everybody is afraid of changes.
Coming to the point, I have the following problem:
(1) I have a date.
(2) I need that date in this format: "mm-yyyy", written in a certain cell.
(3) BUT: the cell should NOT contain the date itself, but JUST the text (some tables in the background need this format)
(4) Changing the cell to text-format is not eligible, since it puts an " ' " in front of the numbers.
(5) The cell should be formatted as a number.
So, in conclusion:
I need a string/number with the date in this format: "mm-yyyy" in the cell formatted .NumberFormat = "0".
I'm working on an existing workbook...
I decided to add some code and a screenshot. This code will return the number, which lies behind the date, and write it into the cell. So that's not what I want, but maybe the code clarifying what I need anyway.
The screenshot shows the wanted output : screenie.png
if the active cell is formatted as number and I write
x = Cells(Row, Column).Value
and the cell is empty or blank, x will be set to 0.
How can I determine that the cell is blank and not actually 0 ?
How to change a "ddd' formatted cell and change it to a text string (even if you have to use another set of cells)?
I have 3 columns of cells A,B,C.
Column A has dates in it.
Column B has the "ddd" format of the A cells (takes date from A cell and turns it into the day of the week...ex:2/17/2012 into "Fri")
Column C is the one I want to formatt whatever is in the B column into a string, such as "Fri" but with it being text instead of "ddd" formatted.
How can I interrogate the contents of a cell to determine whether or not it contains a number formatted as text? I intend to run a .value = .value over each such cell to convert it to a number format, but I only want to do this to relevant cells.
View 9 Replies View RelatedIs it possible to delete the work 'Strike' purely based on it's formatting I.E: as having a strike through set against it?
Im thinking it's not! I know you can use 'Find and Replace' for single cells with single words in, but not out of a sentence?
This is my first use of the forum as I only joined yesterday after a recommendation from another colleague.
I am attempting to write a macro to clear the contents of cells in a range that have conditional formatting. Below is the formula I have used...
Sub clr()
Dim r As Range
For Each r In Range("09:050")
If InStr(r.Interior.ColorIndex, "40") Then r.ClearContents
Next r
End Sub
While the formula runs without error, it does not clear the contents, although I read on another thread on this forum that you cannot clear contents of cells that are conditionally formatted.
Alternatively, if there is a more efficient way to clear cell contents (without using a formula in the cell itself),
see sample file, i need a formula to do like B column,
I WANT MAKE LIKE B COLUMN, COMPARE A COLUMN DATA IN C,D COLUMN AND ALL DATA SHOULD BE IN B COLUMN..