Text And Formatted Date & Time In Cell
Mar 19, 2008
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.
View 9 Replies
ADVERTISEMENT
Jul 19, 2014
I am using Excel 2013. Anyway, the first issue is that I need to pull a date and a time period from text. So, for example, if I see something like Sunday Prime Time 7/6/14 8:37PM, I would want to pull ONLY the "7/6/14 8:37PM" out of it. Each text box could potentially be different, so it might not always be in the same format as "Sunday Prime Time 7/6/14 8:37PM" it might only show just the date and/or the time without all the extra text i.e. 7/6/14 8:37PM. Some of the cells will have text, others might only have just the time or even just the date and the time. The only thing that I am worrying about in each cell is extracting just the date and time. If this is too much to ask of excel, I would be ok with extracting ONLY the time - 8:37PM and not the date, but I would much rather be able to get both the time and date.
THEN, onto part two of my question. After I would pull the dates and times, I need to compare them with each other. So, when I have the same date with two separate times on that date, I need to write a formula to show if those times on that date are less than 30 minutes apart. So, if I have 6 times on 7/6/14, I need to know if any of them are less than 30 minutes apart.
I would need to have the formula say something like "Problem" if the times on 7/6/14 would be 5:30PM, 5:48PM, 7:00PM, 8:00PM, 8:15PM, and 9:00Pm for example. I would like to see the word "Problem" since 5:30PM and 5:48Pm is only 18 minutes apart, and "Problem" after 8:15PM since that is only 15 minutes past the 8:00PM which is obviously under 30 minutes. The times that are more than 30 minutes apart such as 7:00PM and 9:00PM for example are more than 30 minutes apart from any of the other times that were extracted.
View 7 Replies
View Related
Aug 4, 2009
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.
View 11 Replies
View Related
Aug 11, 2006
I'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 Replies
View Related
Mar 14, 2009
I'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
View 2 Replies
View Related
Aug 11, 2006
I'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 Related
Dec 30, 2008
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 Related
Mar 23, 2007
In Cell A1 Value is: 20070322_023047_002035_1112223333
above code is like Date(YYYYMMDD)_Time(HHMMSS)_Agent#_Phone#
I want result As per Following:
In Cell B1: 03/22/2007 Date(MM/DD/YYYY)
In Cell C1: 02:30:47 Time([HH]:MM:SS)
In cell D1: 002035
In cell E1: 111-222-3333
View 10 Replies
View Related
Feb 17, 2012
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.
View 4 Replies
View Related
Jan 2, 2009
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 Related
Jan 28, 2009
Is 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?
View 9 Replies
View Related
Nov 11, 2009
I'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.
View 6 Replies
View Related
Jun 22, 2008
i have the following code to insert comments into cells, however if the user cancels the input box (i.e. doesn't insert any text), a comment is still added with their details and the comment 'FALSE'. Is there anyway to stop comments being added if the user cancels the input?
Sub Insert_Comment()
Dim iReply As Integer
Dim cl As Range
Dim sComment As String
Dim sText As String
Dim UserNameWindows As String
View 4 Replies
View Related
Feb 21, 2013
I import data from a program that exports dates and times as text. I have been successful using "text to columns" to separate the time from the date and then using =text(A1,"00:00")+0 to get the time to show as serial time but I'd love to be able to do the whole date/time string in one step. In cell A1 there is data that is general format and is in this format:
01/01/13 00001
No matter how you try to format it, it is not a date or time. For this project I need the serial number for the date/time. Any formula that will format it as date/time and then allow it to show as a serial date/time?
View 3 Replies
View Related
Apr 22, 2008
I have 04/02/08 12:00:01 AM (mm/dd/yy hh:mm:ss AM/PM) in text format in a cell. I need to convert this to date/time custom format as given above so that I can make comparisons with NOW() output.
View 2 Replies
View Related
Oct 20, 2009
What is the code i need to use to assign a macro to a command button which inserts the current date and time in the selected cell regardless of where that cell is?
View 5 Replies
View Related
May 2, 2014
I have an Excel 2010 spreadsheet that I am using to save several numbers all in the same column. These numbers can range from the several thousands up to billions. The formatting I am using for these numbers is Number (using 1000s separator).
number_forma.png
I am also using the spreadsheet to generate a text string for each of the numbers. I don't want the text string to show the number as it is, I want to shorten the number by only showing the first few digits followed by a "B" for billion, "M" for million, or "K" for thousand. For example, in the text string I want to show 1,600,000 as 1.6B.
In order to shorten the number I use the cell in the column to the right of each number. This cell uses the following custom formatting (which I found by doing a Google search): [>999999999.999]#.0,,,"B";[>999999.999]#,,"M";#,"K";
custom_format.png
As you can see the formatting is quite complex (at least for me it is) but it does what I want it to do.
Here is a screenshot of what the original and custom formatted cells look like:
custom_formatted_cells.png
As you can see the custom formatting works and does exactly what I wan
The next column (after the custom formatted number) is where I put the generated text string for each of the numbers. As I stated above, I want the generated text to use the shortened version of the number (e.g. 1.6B).
To generate the text I use the CONCATENATE function with a reference to the cell containing the shortened number as one of the arguments. For example:
CONCATENATE("SOME STRING ", B1)
Where B1 is the custom formatted cell.
The problem I am running into is, the text that gets generated doesn't show the shortened format of the number, it shows the full number. Here is a screenshot demonstrating what is happening:
concatenate_formula.png
As you can see the generated text is "SOME STRING 1600000000". This is not what I want. I want the generated text to be "SOME STRING 1.6B".
I think I understand what's going on. When the CONCATENATE function references a cell it takes the actual value of the cell and ignores any formatting. (I suppose formatting is just the way you see the data, not how underlying functions receive the data.)
My question is, how can I re-write the CONCATENATE function (or use another function, etc. available to me) to use the formatted version of the cell?
*UPDATE* I have attached my spreadsheet as an attachment to this post (tackyjan_excelforums.xlsx). Please note that it was created and saved using Excel 2010.
View 8 Replies
View Related
Oct 13, 2009
I'm trying to write a VBA code for converting the date/time as text to a date/time value.
The scenario is, I have three different types of text :
ddmmmyy
HH:MM
ddmmmyy:HHMM
I could have the code working fine with the first two types, but not the last one.
View 4 Replies
View Related
Mar 28, 2014
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))")
View 3 Replies
View Related
Nov 13, 2009
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.
View 3 Replies
View Related
Mar 25, 2012
I have recently found that when I copy ranges (usually containing formulas), I only have the option of copying these ranges as text ( or vales). I can no longer copy formulas , (or formats, col width etc) in my excel worksheets.
This problem has only recently occurred and applies whether i have one or many spreadsheets open.
View 6 Replies
View Related
May 30, 2014
I have a spreadsheet where i do need to count cells values that are formatted as text but i do need to ignore the real text in some cells, in this formula i do need to add values depending of the adjacent cell.
I have attached a example : New Microsoft Excel Worksheet.xlsx
View 8 Replies
View Related
Aug 6, 2012
I have a strange issue. I have column "B" has date texts in it ( don't know if it means value) like 21.09.2012. The cells are in text format.
VB:
Sub ReFormatCell()
Range("B:B").Select
Selection.NumberFormat = "dd.mm.yyyy ddd"
With Range("B:B")
.Formula = .Value
End With
I tried ".Value = .Value" or ".Formula = .Value" or Copy paste or offset...... Non of the codes didn't work to make date format as I desired :/
The order is something like:
1. Format column "B" as text.
2. Offset text value 21.09.2012 to B.
3. Reformat cell as date
4......?!?!
What should I change to display "21.09.2012" as "21.09.2012 Wed" in B:B range?
View 9 Replies
View Related
Sep 6, 2006
I have one column with as many as 50,000 or more rows. The data format for each row/ cell is unique as shown below ( date and time). I wanted to split the data as shown in "Formatted Data" below. Have Tried Text To Column formatting but didn't work right.
Raw Data: Formatted Data (2 cells):
2005/11/02 23:55:15.758 ==> 2005/11/02 23:55:15.758
2005/11/02 23:58:16.698 ==> 2005/11/02 23:58:16.698
2005/11/03 00:07:13.830
2005/11/03 00:10:14.971
View 6 Replies
View Related
Nov 16, 2006
this code works fine on my desktop but on 2 of work's pc's it produces a error at the msgbox line
Private Sub Workbook_open()
'http://www.ozgrid.com/forum/showthread.php?p=306542&posted=1#post306542
Dim dDate As Date
dDate = Sheet16. Range("a1").Value
MsgBox "Today is the " & Format(dDate,"dd/mm/yy"), vbOKOnly
End Sub
i have changed the security settings in macro's and one of them was using office 2000, not sure about the 2nd one but i will check next time iam at the office and grab the error codes.
View 2 Replies
View Related
Dec 28, 2006
I have a Excel Dates & Times column where the time is not always used. In these cases the time is 12:00AM. Is there a way to Custom Formats the cell so that the time is only visible if it is not 12:00AM?
View 6 Replies
View Related
Mar 9, 2008
I have a problem regarding sorting data having date and also time within a single cell.
Example data (I have written it as code to preserve formatting)
A B C D E F
12/5/2008 02:072/5/2008 06:0128804833363
22/5/2008 18:012/5/2008 18:0599271297
Column B is start date and time whereas Column C is end date and time.
My aim is to cut and paste the whole row automatically to Sheet2 if the time is within 2AM to 8AM else leave as it is.Also I don't know anything about VBA Script.
View 9 Replies
View Related
Aug 21, 2013
I have a spreadsheet where an engineer is expected to record sample temperatures of water outlets, along with the time he took the sample. Each outlet has a row on the spreadsheet with a column for the Temperature and column for the time. I would like to automatically input the current time(or time and date) on each line as the temperature is entered.
View 4 Replies
View Related
Oct 29, 2006
how can i get a cells date into a message box string? i have been trying to get this to work
Dim Date As String
Date = Sheet16.Range("a1").Value
MsgBox "Today is the & Date ", vbOKOnly
View 3 Replies
View Related
May 3, 2007
I have a cell E1 that is actually a vlookup and returns a date. I had to custom format the cell so the value returned looks like "June 2007" instead of "39827". I am running a macro and I need a messagebox to tell the user that they are creating an email for June 2007 (which is really the variable cell E1). Problem is the message gives the date as '6/4/2007' instead of 'June 2007'. I tried using the text() function to format the cell as "mmmm yyyy" but I get a type mismatch error. Below is the code I wrote. The first way shows successful but the date as numeric. The second gives me the type mismatch error: First way:
a = Range("e1").Value
Msg3 = "You are about to create an email for " & a & ". Are you sure?" 'Define msg
Style = vbYesNo + vbQuestion + vbDefaultButton2 ' Define buttons.
Title3 = "Create new file" ' Define title.
Response3 = MsgBox(Msg3, Style, Title3)
If Response3 = vbYes Then ' User chose Yes.
'create email
Second way (mismatch error): a = text(Range("e1").Value, "mmmm yyyy") Msg3 = "You are about to create an email for " & a & ". Are you sure?" ' Define message.
Style = vbYesNo + vbQuestion + vbDefaultButton2 ' Define buttons.
Title3 = "Create new file" ' Define title.
View 2 Replies
View Related