Dates In Text Format
Oct 26, 2006
I am also new to vba (am teaching myself with the help of the guru's on this site!). My problem is to do with dates. I have created a variable in VBA that reads a cell with the value of a date in text format, for example SEP2006. I want to use this value to paste into another excel cell. When I do it actually creates it as a numeric date when I really want to just use it as text, "SEP2006". I have been looking at this for a while and I'm not sure if it's a case of "can't see the wood for the trees". A small example of my code is:
Sub DateValue()
Dim dateValue As String
Range("D2").Select
datevalue=activecell.text
Range("a3", [b65536].End(xlUp).offset(0,1))= datevalue
End Sub
View 3 Replies
ADVERTISEMENT
Aug 4, 2014
I have a range that contains dates, with some cells within containing text (e.g. "TBC" or "planning will occur wk42"). I have basic rules as below:
- highlight red if older than today
- highlight green if today or in the future
The problem I have is that the cells that have text are highlighted green which I don't want. I also don't want to have to go through the range removing conditional formatting from each of those cells each time I copy over new data. Is there a way of telling excel to not use conditional formatting on those cells that contain text so I can manually highlight as I need? Some have text as that is how I receive the data.
View 2 Replies
View Related
May 16, 2007
Is there a way I can convert dates to text in a CSV file (opened via excel) using a macro?
Currently I have excel recognised dates in the first column of the format dd-mm-yyyy and a corresponding values in the second columns.
I know once I have the file open I can enter the following formula in an adjacent coloum "=text (A2, "MMM-YYYY") but I need to change the format in the existing date feild and not create a new coloum. Sure I could copy and paste the new formatted dates into the cell, but in terms of what I need to do, this is not practical as I several of these CSV files that I need to query and extract data from daily using a macro.
The macro is not currently working because the date format is wrong. I need it to appear as MMM - YYYY. When you view the date in excel it must appear like this (as it would appear in say microsoft word) and not with the underlying date format.
View 9 Replies
View Related
Sep 17, 2008
I have a VBA subroutine that builds a list of dates in an array and then copies this to the worksheet using worksheetfunction.transpose. The array is two dimensional and therefore uses the variant data type.
This works fine in Excel 2002. In Excel 2003 the array is fine until the Transpose function is used, at this point they are changed from dd/mm/yyyy to mm/dd/yyyy. This means that some dates are changed (eg: 01/Mar/2008 becomes 03/Jan/2008) and some are written as strings (eg: 17/Mar/2008 becomes the string "17/03/2008" and cannot be operated on as a date).
I'm aware that there was a hotfix to deal with a similar issue regarding recalculation but this is on Excel 2003 SP3 which should already have that hotfix in place.
I have reduced my code down to a basic demonstration showing the problem. This assumes the worksheet contains some dates in "A2:A32". I have also attached the workbook containing this code.
VB:
Private Sub CommandButton1_Click()
Dim a() As Variant, c As Integer
Redim a(1 To 31)
For c = 1 To 31
a(c) = Cells(1 + c, 1)
Next c
Range("D2:D32") = WorksheetFunction.Transpose(a)
End Sub
I have fixed this problem by looping through each element of the array and writing them individually in to cells but this is far slower so I'd like to know if there is a better solution than that.
View 2 Replies
View Related
May 14, 2009
Hi Guys, This has been bugging me for a bit now and I just can't sus it...
I have a sample perpetual calender that I have been modifying to fit my own purpose. The calender part works fine.
I have beside that a column for holidays, etc and then a another column for other events.
When I put the date in the holiday or events columns I would like the date to be highlighted in the calender above (different colour depending on which column it came from).
The formula I have been playing with (no success) is:
=MATCH(DATE($R$2,1,C8),$I$41:$I$65,0) - This is the Formula for the 1st column of dates.
The 2nd formula is similar, just changes the column it tries to draw the MATCH(DATE.... from...
Although this formula works fine on the sample spreadsheet. When I enter the formula on my sheet, it doesn't seem to work...
I have attached the spread sheet that I am working on.
View 2 Replies
View Related
Apr 4, 2008
there are a multitude of issues with US date formats when you're not in the US but I've run across one that I can't figure out.
I have a source table that has approx 5000 lines on it, everything looks correct and all the dates are in the correct (Australian) format. However when I use it to make a pivot table, any dates that are before the 12/m/yyyy gets changed to the mmddyyyy format in the pivot table only, all the source dates are still correct.
View 3 Replies
View Related
May 23, 2014
I have a some dates in a format which are not being converted into the normal date format. So i made this formula to convert it into the normal date format:
=IF(LEN(B218)=10,(MID(B218,4,2)&"/"&LEFT(B218,2)&"/"&RIGHT(B218,4))+0,IF(LEN(B218)=9,(MID(B218,3,2)&"/"&LEFT(B218,1)&"/"&RIGHT(B218,4))+0,IF(LEN(B218)=8,(MID(B218,3,1)&"/"&LEFT(B218,1)&"/"&RIGHT(B218,4))+0,"")))
Formula is working fine except on this type of date "9/9/2013"..i also tried an OR formula with mid but didnt get the desired result.These are the type of dates:
12/10/2013
12/9/2013
9/11/2013
9/9/2013
7/25/2013
View 9 Replies
View Related
May 24, 2006
(Date1-Date2) : what's the format I should use to obtain the result in number of days.
For example :
(23/12/2006 16:30:00) - (18/11/2006 15:30:00) : It should give 35 days 1 Hour (35:01:00:00 - dd:hh:mm:ss)
How can I have this format (dd:hh:mm:ss)
View 9 Replies
View Related
Oct 21, 2011
I am in strange situation where I have a data with Invoice Dates. These dates are in Text. However, when I convert it into reall excel dates. For some reason the dates do not come right. convert my text dates into excel real dates. I did a lot of google search and apply these three methods but all of these gave me strange result I was not expecting. These are the methods I used and the result of each method.
Method 1 : Using Text to Column Wizard (Excel 2007)
I highlighted invoice column and went into text to column wizard. I clikced on Date button, and selected MDY format. Strangely enough, my result was day, month and year i.e. DMY which does not seem right.
Then I press Control ~ on this data as shown in second view.
Inv DateMDY09/22/1122/09/201108/31/1131/08/201108/31/1131/08/201108/31/1131/08/201108/31/1131/08/2011
control ~ (overview)
Inv DateMDY09/22/114080808/31/114078608/31/114078608/31/114078608/31/1140786
2nd Method - Using formula to convert text date to real dates When I used formula, I get the following result. As you can see, formula is converting text dates into different system dates than the first method.Further strange things is when I take these system dates i.e. 4283 and in 2007 excel format use "Short Date" the same system date gets converted into wrong year as shown in the second view.
Inv DateFormulaFormula Result09/22/11=DATE(MID(B2,7,2),MID(B2,1,2),MID(B2,4,2))428308/31/11=DATE(MID(B3,7,2),MID(B3,1,2),MID(B3,4,2))426108/31/11=DATE(MID(B4,7,2),MID(B4,1,2),MID(B4,4,2))426108/31/11=DATE(MID(B5,7,2),MID(B5,1,2),MID(B5,4,2))426108/31/11=DATE(MID(B6,7,2),MID(B6,1,2),MID(B6,4,2))426108/31/11=DATE(MID(B7,7,2),MID(B7,1,2),MID(B7,4,2))4261
2nd view - system dates are getting converted into 1911
Inv DateFormulaFormula Result09/22/11428322/09/191108/31/11426131/08/191108/31/11426131/08/191108/31/11426131/08/191108/31/11426131/08/191108/31/11426131/08/1911
Similarly, I tried other methods or copying blanks etch but none seems to convert text dates into real (system dates).
View 4 Replies
View Related
Nov 14, 2013
I would typically consider myself a decent Excel user, but I haven't been able to solve this one. Maybe it's just the lack of sleep now. I am attempting to combine 4 cells into one where the last cell contains a date. Below is the formula I am using:
=B3&" "&C3&" "&D3&" "&TEXT(E3,"m/d/yy")
It works when all of the cells have values, but the only problem I am having is that some of the dates (in column E) are blank. When this cell is blank the default date that displays is "1/0/00." If I add the typical, " " at the end it says the formula has errors. The need for the TEXT(E3,"m/d/yy") for the cells that contain dates is throwing me off.
View 3 Replies
View Related
May 18, 2007
I have a very large spreadsheet that comes out of SAP and it brings out the majority of cell entries as text ie putting a ' at the begining of any number. the problem that i have is with the cells that have a date in them ie '19/04/07. I have tried varioous methods to remove this and turn the cells into date format but to no avail.
Also i do not get the option to convert text to number
View 6 Replies
View Related
Feb 13, 2008
I have a WAY to complicated excel form that I'm going to move to Access but I need to have this working in the interim. The form has a dynamic element, the user can choose the number of items they are ordering and it unhides the required number of text boxes. To keep the scripting down a did a little work-around to update the database using a loop through the form controls:
'Save the main row
MainOrderRow = ActiveCell.Row
LastRow = MainOrderRow + (ExtraOrders - 1) ' Calculate the last row
ExtraOrderNo = 1
For DBRow = MainOrderRow To LastRow
' Save the text box name with the extra order number
k = "txtDescriptionMul" & ExtraOrderNo & ""
l = "txtQuantityMul" & ExtraOrderNo & ""
m = "txtTotalValueMul" & ExtraOrderNo & ""
n = "ComboBoxUnitMul" & ExtraOrderNo & ""...................
View 2 Replies
View Related
Aug 9, 2008
I have a macro that searches and replaces dates (both text and date formats) in all files in a folder. It works if I initiate it from the VBA Editor, but not if I initiate it from the file.
It seems that the worksheet is not activating. Please take a look and let me know what I can try.
Things I have already tried: Window methods, such as minimizing the workbook that contains the macro, activate next, etc. Also putting the macro in Personal.xls and retrieving the values from the other file.
Where it hangs is right after the first workbook in the folder is opened. I tried to get it to select A1 in the active sheet but that cell is not selected in either the macro workbook or the newly opened workbook.
Also, if there is an easy way to exclude my macro file (name contains ZZZZ) from the FileSearch............
View 9 Replies
View Related
Mar 1, 2007
In order to export an excel table into another program I first need to save the excel file as .txt. The .txt file can then be imported by the other program.
First I however need to make excel understand that the value should be a text and not a value. I therefore format the number as text (0000150235) by adding "0000150235". After saving the file as .txt the format changes from "0000150235" to """0000150235""". I do however need the format in the .txt file to be "0000150235". Can anyone tell me how I can save "0000150235" as .txt and get the value "0000150235" in the .txt file.
View 14 Replies
View Related
Jan 10, 2007
I have an excel sheet full of dates in text format and want to convert them into regular format. For instance, one of the dates listed is in text as "60801". I'd like it to show in regular date format of mm/dd/yyyy, so that 60801 becomes 8/1/2006.
View 9 Replies
View Related
Jun 18, 2013
I have row 1 contain dates as:
[Code] ......
and so on ..
And I want all dates that is saturday and sundays marked in grey. If its possible I want the whole D column marked grey (if D1 is a saturday or sunday), is it possible?
View 1 Replies
View Related
Oct 6, 2008
Example......
In D2 I have: =B2
In D3 I have manually input: (space)3-08
As you can see the CONCATENATE puts the "39569" date in A2 But the second line puts the text date as I prefer. What I would like to do is put in a formula or macro in D2 and down that will change the "Mar-08" to "3-08" so it CONCATENATEs correctly to column A. Simply: I'm trying to avoid manually inputing the text version "3-08" (or whatever M-Y) into D2 down a hundred or so rows!
View 3 Replies
View Related
Oct 11, 2012
I want to convert number format to text format, any formula ?
View 6 Replies
View Related
Nov 21, 2006
how i convert text format into numbers format in vb.
Currently
i have a formula in vB:
Private Sub Textbox3_Change()
Textbox3 = Val(Textbox1.Value) + Val(Textbox2.Value)
End Sub
however..when i sum it up (in excel) using"=sum" formula...it ooes not sum up
I faced an error "number stored as text"..how to i convert it to numbers format in vb.
View 9 Replies
View Related
Feb 13, 2008
Need to create a set of aligned text amts from various cells...Tried Format but unable to get right combination...I've looked at many threads and most seem related to getting amt from text instead of reverse.
Cell may contain nothing or a monetary amt, negative or positive. Output needs to be in format of "$9,999.99-" or similar...with leading zeros suppressed but a min of "$ 0.00" showing, so that above/below amts with be decimal point aligned in a fixed font situation.
I've almost gotten my routine finsihed but this is last remaining obstacle.
View 9 Replies
View Related
Sep 14, 2007
I'll get straight to the point: How can I change this text format from 474556788 to 0-47455678-8 (dash added after 0 and before the last number). I need to apply this to around 5000 rows (can't do that manualy). I want it to be int his format:
474556788 to 047-455678-8
Tks Auto Merged Post;474556788 to 047-455678-8 (This is the wanted format)
View 10 Replies
View Related
Dec 6, 2013
I have a file from a database that includes birthdays and anniversaries. These are mainly in US format as far as I can tell, but I am trying to get these all in UK date format but when I try and change any of the formatting half of them don't seem to change.
I have attached the file : Dates.xls
View 2 Replies
View Related
Mar 30, 2013
I have used excel for years. I understand how to format dates. However, lately, after I tell the cell to format it as a date, and then type in a date, it inserts some random date (not the numbers at all that I entered).
View 8 Replies
View Related
May 25, 2009
I am trying to move the data from sheet1 column A to sheet2 column A while reformatting the data from its current format (dd/mm/yyyy) to format (mm/dd/yyyy). The data from sheet1 is provided to me by a client and is produced daily through their system which they have told me they cannot change the formatting on the reports. When i try to move data from sheet1 to sheet2 and reformat it only half the data formats into the correct date format. does anyone know how to get the data from sheet1 to format and move to sheet2 properly?
View 3 Replies
View Related
Feb 15, 2010
I have attached a sample of the raw output of some call records from our telephone switch. My problem with the date data is twofold; first of all it outputs it in mm/dd/yyyy format, or so it appears. But when I try to change the format to mmm/ddd/yy Excel always interprets the 2nd pair of digits as the month instead of the first two. For example,the following 2 calls are from Jan 1st and Jan 2nd respectively;
01/01/2010
01/02/2010
but excel always treats the 2nd record as Feb 1st. I have read numerous posts from people with similar problems but I can't get any of their solutions to work with my data.
The second problem is that on the 13 of each month the phone switch suddenly stops putting a leading zero in front of the date making the data totally unreadable to Excel apparently. Again, I read a post of a similar problem but can't get their solution to work. My ultimate goal is to reformat the date data so that it is displayed as; ddd mm/dd and leave out the year entirely. Ex. Fri 02/12 as in today...Friday, Feb 12th. I really don't know if the problem is with the data or me at this point.
View 2 Replies
View Related
Apr 2, 2008
I'm in the process of setting up an Excel document and I need to be able to have it display dates in a specific format. I need it to express just a month and year such that the month is represented by a letter (A thru L) and the year is expressed as its last two digits such as in the these examples:
May 2012 = E12
Mar 2009 = C09
Nov 2011 = K11 etc.
I want the date to come out in this format regardless of how the user enters it.
View 10 Replies
View Related
May 4, 2014
Below is a format of dates I want to make it in weekly format, select the Fridays or any specific day and separate them from this list.....
01-10-2013
03-10-2013
04-10-2013
07-10-2013
08-10-2013
[Code]....
View 3 Replies
View Related
Jul 21, 2014
I have dates (column E) and times (column F) currently in the format mm/dd/yyyy and hh:mm .
However, my formula in excel deals with dates and times in the format mmddyyyy and hhmm. How do I change the values of the dates to exclude the "/" and the times to exclude the ":" operators?
I want to change the actual value of the cell too. Basically, using custom format mmddyyyy in the date column will not work (because the true value of the date will still yield mm/dd/yyyy.
View 1 Replies
View Related
Jan 16, 2007
I need to format dates on the data labels of my pivot chart. My table has the correct format: dd mmm yy but the chart is showing dd/mm/yyyy.
How do I change this?
View 9 Replies
View Related
Mar 17, 2007
I have a spreadsheet with due dates in column X. I want to create conditional formatting so that cells turn red when the due date is less than or equal to 30 days away, but turn gray when the due date has passed.
I've accomplished the first step by using the following: =AND($X6
View 9 Replies
View Related