Macro To Convert Text 'dates'

Jul 21, 2008

I am trying to convert text 'dates' like Sat. 1/05/2007 to real dates. I need to find all 'date' cells in range B4:B100 (they are filled in yellow), strip off the offending text (i.e. Sat.), and use DateValue to turn the rest into a proper, numerical date in the ddd mm/dd/yy format, arial, bold, 10pt, and centered in place.

I've spent days trying to write this macro. I've had help from experts in forums, but whenever I need to make any slight modification, a trainwreck ensues. Please see the code below.

View 10 Replies


ADVERTISEMENT

Convert Dates To Text Format Using A Macro

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

Excel 2007 :: Unable To Convert Text Dates To System Dates

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

Convert Imported Text Dates To True Dates

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

Convert Dates To Text ...

Sep 12, 2008

I have a columns with dates such as 10/24/2007. The next column has a count of widgets made that day.

I tried creating a column in between the two that would show only the Month and Year. I intended to base a graph on the converted dates and count, to show how many widgets were made a month. But

the graph breaks down the count to the individual days, ignoring the conversion. Is there a way I can create a column that will literally take the date number and leave only a text in its wake? So that when I slect the latter two columns, the graph will only show the months and counts in that month?

View 9 Replies View Related

Convert Dates To Text

Nov 10, 2009

I need to convert values in column A that Excel has erroneously formatted as date, to text.

4/9/5281 should be 5281049
(Excel dropped the zero in front of the 4. I need it back.)

14/9/5281 should be 5281149

View 9 Replies View Related

Convert Date Looking As Text To Dates

Feb 12, 2009

I have a column wherein the dates are treated as text , i want to convert that into dates.

View 9 Replies View Related

Convert Text To Dates - Cannot Group This Selection

Jun 26, 2014

I am having an issue with converting what seems like Text to Dates. I am trying to group dates in my pivot table, but I keep getting the error "cannot group this selection". My dates are left justified, causing me to believe that they are text.

When I format the cells, however, the cells say that they are already in date format. When I try using Text to Columns in the Data Tab and selecting MDY, I get the error "You cannot move a pivot table table report or insert worksheet cells, rows, or columns."

Not sure what to do from here, as I would like to group dates by weeks.

View 9 Replies View Related

Macro To Convert Dates To Correct Format

Jun 7, 2013

When I import data , the dates appear as follows in Col G sheets "Imported Data"

If I select Col G and use Text to columns and select mdy, it gives me the dates in the correct format. However, If I use the macro recorder to do this and then run the macro, it does not work

I have attached the dates after using text to Columns wjhich is the correct format.

Imported Assets *G207/01/2006302/01/2007402/01/2007511/01/2008601/01/1985720/11/1990801/01/1985901/01/19851001/01/19851101/01/19851225/09/19921302/01/1993

Imported Assets  G201/07/2006301/02/2007401/02/2007501/11/2008601/01/1985720/11/1990801/01/1985901/01/19851001/01/19851101/01/19851225/09/19921301/02/19931401/05/19931501/06/19931601/08/19931701/01/19941801/09/1995

View 2 Replies View Related

Macro To Automatically Convert PrtScr Image Based Text To Real Text In Cell

Mar 22, 2014

Programming Excel VBA Macro to do OCR (text recognition) from a prt scr screen capture image and input the text into cells. Currently my Excel file has a push-button, and upon clicking on it the macro pastes into Excel the current clipboard image I have created by pressing prt scr while in another program. The macro then crops the image to the region with the applicable text. I have to then manually type the text I see in image format into the appropriate cells.

the VBA coding to automate this? I'd like it to use the clipboard image and run it through OneNote OCR, after which the applicable text values are automatically entered into the cells. Ideally the code will first crop to the region with the desired text before it does OCR. If this is not feasible, it will need to incorporate a method (keyword search?) to hone in on the desired text after the entire prt scr image has been OCRed.

View 8 Replies View Related

Difficulties With Dates (convert The Column Of Dates To Say Mar 14 2009 Type Date)

May 3, 2009

look at the attached file - it was a CSV file. i want to convert the column of dates to say Mar 14 2009 type date. but it only converts some of them.
note some are on the left and some on the right.

View 5 Replies View Related

A Macro To Convert All Such Text To Numbers?

Feb 26, 2014

I am extracting a large set of numbers forming various tables from SAP. These numbers are not recognized as numbers and have Formula error. Only way to further process them is to convert them to number using 'Error Checking' option from 'Formula' Tab.

I need a macro to convert all such text to numbers, note there are no other formula errors.

I have other macro to delete rows, columns, take sum and create new Summary Table from the data but that does not work until I manually convert text to numbers.

how to have the macro globally i.e, I need to only open the extracted data in excel and be able to run the Macros. Presently I open the extracted data and also open the master macro-enabled file to access the macro.

View 1 Replies View Related

Macro To Convert Text To Column?

Jul 10, 2013

I am facing difficulty in creating a macro which will convert column A text into 2 separate columns (A & B) with tab & colon as the delimiters.

View 8 Replies View Related

Convert List Of Dates To Count No. Of Dates By Week

Jan 27, 2006

Basically I have 2 columns each with a list of dates in no particular order (and containing blank cells too), one planned date column and one actual date column.

What I need to do is plot this on a graph, and since the number of dates has no set limit and I dont want to have to plot maybe 100 dates on the x axis, so i want to group them by week before plotting them, i.e. 10 dates for week ending 10th jan, 25 dates for week ending 17th jan etc

I have a pivot table that counts how many of each date occurs, i.e. 10 x 2nd jan, 7x 3rd jan etc etc but it does not split them into weeks.

im sure theres an easyish way of doing it so i can get the 2 lines on the graph for no. of planned dates each week and no. of actual dates each week, i just cant see it.

View 13 Replies View Related

Convert Numbers, Representing Dates To Actual Dates

Oct 15, 2009

I get a spreadsheet every day that has a column of numbers that contains dates that are not in a date format. Is there a way to convert these numbers to a date format? The numbers come from an outside source so I can't modify on the front end. look at the attached spreadsheet with representative data of what I'm trying to ccomplish.

View 2 Replies View Related

Convert Numbers Representing Dates To True Dates

Jun 29, 2008

I import data from my works server and dates are represented in text. example text format is yyyymmdd/19790310. What I'm trying to do is add and subtract from this date. I was trying to utilize formula and havent got close. I have a couple of parameters:

In column L I would like to represent the following

if column "B" is "A" add 38 years to column "J" dates are represented as TEXT
if column "B" is "B" add 35 years to column "J" "
if column "B" is "C" add 30 years to column "J" "
if column "B" is "d" add 30 years to column "J" "

Column "M" I would like to find the difference in column "L" and "C" I know days will be difficult it can be represented in years and months only.

I have no preference on whether I use VBA or a formula but have failed on on formula and was attempting to use VBA Case method but no success. I have 10000 rows of information and am open to any ideas attached an example of my data.

View 7 Replies View Related

Excel Macro To Convert Text To Number

May 16, 2014

I have a very large exported data base to excel. See the Attachment. I have columns on the left with text that needs to stay as text, and rows at the top with dates. These are my filters to sort and view my data. The current problem I am having is some of the quantities in the bulk of my spreadsheet are coming in as text that need to be converted to numbers (that stupid green triangle in the upper left hand corner). I already have developed a macro to format, sort, extract, and place the data so it's more manageable to look through. I need to get rid of this convert to number error before running this macro.

I am looking to develop a macro that will find each of these "convert text to number" errors and convert the text to number. So far I have been unable to find a starting point.

The sample attached is only 1% of the actual size of the spreadsheet, and my exported data base is variable in size.

The only solution I have at the moment is to go to the bottom of my spreadsheet, find the last error, and highlight everything above and done one convert to number.

Sample.xlsx

View 3 Replies View Related

Macro To Convert Text To Number Without Rounding

Mar 27, 2014

This is what I have so far.

Code:

Range("L:L").Select
With Selection
Selection.NumberFormat = "General"
.Value = .Value =
.NumberFormat = "0.0"

[Code]...

The .NumberFormat = "0.0" is newly added and doesn't work.

View 9 Replies View Related

Convert Text To Long Number Macro

Aug 9, 2006

I have a range of numbers stored as text. I need to convert them to long numbers using vba. I tried typing a simple number = clng(a2), but that didnt work. Can someone help me with A) the right formula and B) the proper end(xlUp) format.

View 9 Replies View Related

Converting Dates- Dates YYYYmmdd To Convert Them To Mm/dd/yy

Feb 19, 2008

I have a long column of dates YYYYmmdd and I need to be able to convert them to mm/dd/yy so that I can see (for example) 09/18/72 instead of 19720918

View 9 Replies View Related

Macro To Edit A Cell & Convert Formula To Text

Oct 13, 2006

Have a macro that copies a formula from each of 100 workbooks to a new workbook. I want to display these formulas as text and want a macro or someway to display these cells as text. I have tried to record a macro that presses the F2 key, the home key and the apostrophe. This works for the one cell but provides the following macro that does not work for anyother cell.

ActiveCell.FormulaR1C1 = _
"'=VLOOKUP($A$30,'G:Variance Reports FY07[Salary Dist Var Repts_Cur Mth.xls]end of July'!$E$76:$G$200,3)"
Range("B3").Select

View 2 Replies View Related

Macro To Convert Dates Format From Yyyy Mm Dd To Yyyy-mm-dd

Feb 25, 2009

I have a 20,000 line Excel sheet...

And all the dates are entered like this:
2009 02 08

I want to add a dash, so they look like this
2009-02-08

so I added a command button, and this code, but its not searching the sheet and adding the dash's...

View 14 Replies View Related

Convert Multiple Text Files Into Excel Worksheets Macro

Apr 1, 2009

i have many file text which i want to open in an excel workbook in a way that each text file will be displayed in an excel sheet.

View 3 Replies View Related

VBA Code To Convert Excel To Text File Of DML Statements (Insert) Using Macro

Jun 11, 2014

I need a VBA code to create a Text file which should be in the form of DML (my scenario is to get Insert Statements for the Data available in the Excel) from Excel Sheet. And this has to be done by assigning a macro to command button where by clicking on it the DML text file should be generated. Even the syntax for the scenario will do.

View 1 Replies View Related

Macro: Combine Dates And Text Into One String

Jun 27, 2008

I have a data sheet which has a series of dates within it. So for eaxample the data sheet will have date of "01/07/2007" I then want to take this data and create the following field:
"June 2008 Pre Data" The problem I have is when I try to join my variables togeother the code crashes (Invalid Procedure call or argument).

The code is as follows ...

View 3 Replies View Related

Excel 2010 :: Macro To Delete Text From Cells And Leave Dates

Apr 27, 2012

I am using Excel 2010 and I need a macro to delete all text from cells and leave the dates.

Below is an example of the contents of six cells. Some have just text, but some have text and dates.

1st Time Attender: 4/8/20121st Time Attender:1st Time Attender: 4/5/20122nd Time Attender:2nd Time Attender: 4/8/20122nd Time Attender: 4/5/2012

In this example, I would want the new cell contents to be:

4/8/2012

4/5/2012

4/8/2012
4/5/2012

View 1 Replies View Related

Compare Two Dates And Convert To Age

Jul 17, 2009

I am trying to compare the difference between to dates (a person dob and the date of an activity they have carried out and then output the age of the person when this activity was done:

for example:

activity date: 08/01/2008
dob: 05/12/2007

View 14 Replies View Related

Convert Dates To Another Format

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

VBA Code To Convert Dates

Feb 15, 2010

I received a solution to a question recently whereby I was instructed to use the text-to columns function to solve a problem I was having with a column of dates.

Convert Dates To Another Format

The solution provided was;
Select Data > Text to Columns > Next > Next > Column Data Format > Date.

The solution works fine when performed manually but if you perform this function while recording a macro, the crucial piece that changes the date output is not captured by the recorder so when you run the macro nothing happens.

To expand on how I recorded it, after starting the text to column dialogue and pressing Next twice, the dialog provides me with a drop down selector where I am able to change the date format from the default DMY to the desired MDY which - when selected manually - fixes my problem. However, when I record a macro while performing this action the date format choice I made is not being recorded in the macro output so when I try running the macro later on the original data, nothing happens.

The recorded macro ends up looking like this; ....

View 9 Replies View Related

Macro To Convert Text To Rows - Inserting Rows

Mar 27, 2013

I have cells (all in one column) containing text separated by commas e.g. (SD-299, SD-200, SD-300)

I am trying to transpose the text in these cells into rows.

VB:
Sub SplitAndTranspose()
Dim N() As String
N = Split(ActiveCell, ", ")
ActiveCell.Resize(UBound(N) + 1) = WorksheetFunction.Transpose(N)
End Sub

The problem with that is that when transposing it does not shift the cells down (/ insert new rows) so I lose the data already in the cells underneath.

Also, that macro would only apply to one cell I would like to be able to apply it all the data in the specific column on my Sheet.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved