Excel date to Numbers text format troubles
I've been sent an Excel .xls document which I'm opening in Numbers '09 (2.1).
The spreadsheet has a date column which I need to be in text format as dd/mm/yyyy. I expected the original Excel document to have the dates already in text format but Numbers says the fields are 'Custom' and shows the dates in US format: 11/04/2011, even although my Mac is set to UK format. No matter, I can set the cells to text format, however that results in the date being shown as 04/11/00002011.
Where did those extra zeros in the year come from!?
How can I reformat the dates to the dd/mm/yyyy format as text?
I've tried a couple of formula to create a new column
=Year(A1)
for example and I think I could recreate the date like that, but the cell must be text format.
DG
Here is the script required to peek dates from Numbers then poke them in Numbers.
--{code}
Apply this script to a Numbers table containing :
B2 : 1943/12/31 23:59
B3 : 1789/07/14
B4 : 2010/01/01 00:12
B5 : = NOW()
set myTimeZone to (do shell script ("/usr/bin/perl -le 'print( readlink(\"/etc/localtime\") =~m{zoneinfo/(.*)} )' ")) -- Perl code by Mark J. Reed.
tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
repeat with r from 2 to 5
set thenumbersdate to value of cell r of column 2
set value of cell r of column 3 to thenumbersdate as text
set thenumbersdate to my TZtoGMT(thenumbersdate, myTimeZone)
tell cell r of column 4
set format to text
set value to thenumbersdate as text
end tell
tell cell r of column 5
set format to text
set value to short date string of thenumbersdate
end tell
end repeat
end tell
--=====
set myTimeZone to (do shell script ("/usr/bin/perl -le 'print( readlink(\"/etc/localtime\") =~m{zoneinfo/(.*)} )' ")) -- Perl code by Mark J. Reed.
set thenumbersdate to my TZtoGMT(thenumbersdate, myTimeZone)
Handlers by Nigel GARVEY
http://macscripter.net/viewtopic.php?id=36449
(* Convert an ISO-format date string to an AppleScript date. *)
on isotToDate(isot)
set n to (text 1 thru 8 of isot) as integer
set ASDate to (current date)
tell ASDate to set {day, year, its month, day} to {1, n div 10000, n mod 10000 div 100, n mod 100}
if ((count isot) > 8) then
set n to (text 10 thru 15 of isot) as integer
set ASDate's time to n div 10000 * hours + n mod 10000 div 100 * minutes + n mod 100
end if
return ASDate
end isotToDate
--=====
(* Transpose an AppleScript date/time from the given time zone to GMT. *)
on TZtoGMT(TZDate, TZ)
-- The difference between TZDate when it's local and the GMT date we want is usually
-- the same as the difference between the local date when TZDate is GMT and TZDate itself …
set GMTDate to TZDate - (GMTtoTZ(TZDate, TZ) - TZDate)
-- … but not around the time the clocks go forward. If the GMT obtained doesn't reciprocate to TZDate,
-- shift to a nearby local date where the above DOES work, get a new GMT, unshift it by the same amount.
set testDate to GMTtoTZ(GMTDate, TZ)
if (testDate is not TZDate) then
if (GMTDate > testDate) then -- "Clocks forward" is towards GMT.
set shift to GMTDate - testDate
else -- "Clocks forward" is away from GMT.
set shift to -days
end if
set nearbyDate to TZDate + shift
set GMTDate to nearbyDate - (GMTtoTZ(nearbyDate, TZ) - nearbyDate) - shift
end if
return GMTDate
end TZtoGMT
--=====
(* Transpose an AppleScript date/time from GMT to the given time zone. *)
on GMTtoTZ(GMTDate, TZ)
-- Subtract date "Thursday 1 January 1970 00:00:00" from the GMT date. Result in seconds, as text.
copy GMTDate to date19700101
tell date19700101 to set {year, its month, day, time} to {1970, 1, 1, 0}
set eraTime to (GMTDate - date19700101)
if (eraTime > 99999999) then
set eraTime to (eraTime div 100000000 as text) & text 2 thru 9 of (100000000 + eraTime mod 100000000 as integer as text)
else if (eraTime < -99999999) then
set eraTime to (eraTime div 100000000 as text) & text 3 thru 10 of (-100000000 + eraTime mod 100000000 as integer as text)
else
set eraTime to eraTime as text
end if
return isotToDate(do shell script ("TZ='" & TZ & "' /bin/date -r " & eraTime & " +%Y%m%dT%H%M%S"))
end GMTtoTZ
--=====
--{code}
Yvan KOENIG (VALLAURIS, France) samedi 5 novembre 2011 14:14:26
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
Similar Messages
-
Hello, I am working with a .csv file that i extracted from a SCADA. When I convert that file into excel 2013, all of the dates become unusable. It appears like the dates have become text. I have tried to convert the date columns into the date format from
the conversion wizard, leave them in the general format, but it stays the same.
The problem with the solutions I have found so far browsing the internet is that my date format appears like this: 06/06/2014 12:58:37 p.m., and no one has given any solution for this kind of format.
Another issue I am facing is that since it is a file extracted from a SCADA I have at least 5000 registers and the width of the file can go from A to AZ, where half of the columns are dates.
If anyone can help me with this, I would be very gratefulRe: a date or something
A number/date will align right in a cell. If your "Date" aligns right then just change the cell number format to meet your needs.
If Excel is treating the cell contents as text (aligned left in cell) then...
It appears as if the punctuation (dots) in the "p.m." suffix makes Excel read the entry as text.
Removing all dots can be done using Edit/Replace or whatever it is called in xl2013.
That may be enought to change the entries to dates. If not you then have to...
1. Change the number format of the cells to the appropriate date format.
2. Force the conversion of the cells to a number/date.
(enter 1 in an empty cell, copy the cell, select the data, use Paste Special (with the 'Multiply' option check marked)
Jim Cone
excel Date Picker add-in (free - no ads, no trackers, no cookies, no registration)
After Installing, Right-click Any Cell
https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2 -
Distinguish Excel Dates from Numbers - Using Apache POI
EDIT: I know this is a common issue, I have read plenty of people reporting the problem, but I have not found a acceptable answer. -- Please help.
O.K. so I have a little class that reads an excel table, and writes the cell values to XML.
The program has always worked great, and even handles the different cell types; boolean, string, formula, numbers.
Problem is dates. Date cells are treated equal to number cells, but I need to distinguish their format type. Right now I read them all as numbers, but I need to change this, because dates occur like 35356(days since jan 01 01).
I tried some basic formating checks;
System.out.println("Date Debug:");
System.out.println(".isValidExcelDate: "+HSSFDateUtil.isValidExcelDate(currentRow.getCell((short) (useColumn)).getNumericCellValue()));
System.out.println(".isCellDateFormatted: " +HSSFDateUtil.isCellDateFormatted(currentRow.getCell((short) (useColumn) )));
System.out.println(".isInternalDateFormat: "+HSSFDateUtil.isInternalDateFormat((int) (currentRow.getCell((short) (useColumn)).getNumericCellValue() )));
// But they return true false false for any number..riddiculus!
Anyway, as it will work now, I'll just read the columns header for a 'date' in the the title. I am anxiously seeking better ideas, please suggest.
Thanks so much!
Notes:
*before and after are not acceptable, because i will have values above 39000 for numbers and dates as low as 1971.
* some reason i can't just read the value as it is displayed in excel ('2007-08-28') which is what I'd prefer. (If you think i can, please let me know how)
*please ask any questions to clarify my situation to resolve :-)
Message was edited by:
Masterkeedu
Acknowledged commonalityThis seems to be a class in 3.5 beta jar file. Try downloading and using the 3.5 beta
-
Excel dates export with wrong format.
When I exported an Excel Spreadsheet with several date columns, they displayed correctly but because of wrong formatting, they didn't sort right. The cell display was, for example, 2/7/2013 but Excel treated it as 7/2/2013 because it was assigning another country's formatting. some of the cells were formatted correctly, but about half of them were wrong and they were wrong in different ways. some were Argentinian, some Carribean, some European. Any ideas how to prevent this from happening?
Go to Sequence>Settings and in the lower left use load presets.
Anything that's in the HD in the sequence will have to be reset using the remove attributes function. If you have mixed media, strange things will happen.
Also use easy setup to change your preset so any future sequences you create will be in the correct format. -
Converting formatted excel date to useful data in labview
I am using the report generation toolkit for Office, and reading an excel file. All the data comes back fine, except for the date column. In excel the column is formatted as a date (ex. 5/5/05) but when it comes through in labview it ends up being something like "37740", it's the same effect if you switch the format in excel to general, the date changes to a number. Is there anyway to leave the formatting the way it is in Excel and still bring into labview a useful date, or would I have to format the excel file differently?
Thanks.I think I have it figured out using the Excel serial number date. I attached a vi of something I threw together quickly to convert excel date serial numbers to labview date info. I'm not 100% if it works all the time, but the few examples I tried worked fine.
Attachments:
Excel date to labview date.vi 53 KB -
I bought Numbers because my Excel files would not work with Mavericks. How can I import a non-functioning Excel file into numbers? (As of now, the file NAME transfers but data does not.)
HI Dave,
I'm surprised you get no message when you attempt opening the Excel document in Numbers.
I'm assuming Numbers 3.1, since you are running Mavericks.
Does the Numbers file that opens show any content?
Does it contain a table?
How large?
Does it contain more than one tab (indicating more than one sheet)?
Do those other tabs contain a table?
Have you checked those tables for data content?
There have been cases in the past of imported documents opening with white text on a white background, giving the appearance of containing nothing. Check for this by selecting a block of cells, then applying a Fill colour or a Text colour using the Format button (paintbrush).
I'd also suggest attempting to open the Excel files using LibreOffice, which can be downloaded from the linked website.
Regards,
Barry -
Hi,
in Italy the format of date is DD/MM/YYYY e the formato of numbers is NNN,DD (DD means Decimal).
I use Excel for IPAD but when I write for instance 28/03/2015 the field shows 03/28/2015, the same problem is for numbers where the comma and the dot are inverted.
How do I change the format of date and numbers?
Thank you in advance.
MaxThe general format of the date is tied to the language...use US english, get US date formatting.
You may want to poke around in excel's settings. I know the desktop version allows you to alter the date formatting, but I'm not sure if the iPad app has that. Look for 'cell formatting' in the settings and see if it's alterable.
If not, you can try to make your template on a PC, then put that excel onto your iPad and see if it honors the cell formatting already in place. -
Convert mm/dd/yyyy text format to date format
I imported a csv file and the date column is in text format. How do I convert it from m/d/yyyy text format to yyyy-mm-dd DATE format in Numbers v 3.1?
Thanks for any help you can give!UPDATE: I found that your formula didnt produce the correct result
It changed mm/dd/yyyy to yyyy/dd/mm — rather than the desired yyyy/mm/dd
By hacking at it, I found that changing the D column formulas around fixed this.
Your original function:
D2=RIGHT(A2,4)&"-"&MID(A2, B2+1, C2−B2−1)&"-"&LEFT(A2,B2−1)
Changed:
D2 =RIGHT(A2,4)&"-"&LEFT(A2,B2−1)&"-"&+MID(A2, B2+1, C2−B2−1) -
Paste date in strings in format of mm/dd/yy to Numbers
I have trouble to paste a list of dates in the format of mm/dd/yy into numbers. For example:
04/01/10
04/23/10
After pasting into Numbers, I got:
2004-01-10
04/23/10
How can I paste a list fo date strings in the format as they are?Check your system's date_time setting .
I guess that it is :
yyyy/mm/dd
On my French system, it is dd/mm/yyyy
so, when I paste your values a I get :
4 janv. 2010
04/23/10
the 1st one is deciphered reversing the day and the month.
The 2nd remain a string because there is no month #23.
Yvan KOENIG (VALLAURIS, France) vendredi 23 avril 2010 10:39:07 -
in fact it's about mac:excel8 or 11 in OSX10.7.4,
how convert in a cell a number written in text format into its value?
cheers francoisHi francois,
If I copyone of them and do a past special/value, it does not work.
Try just Paste instead of Paste Special > Value
I know your question is about Excel, but this works in Numbers:
Copy 1 234 567 (with spaces) and Paste (not Paste Special) into a Cell in a Numbers Table. The result is 1234567 and it behaves as a number. A formula will consider it to be a number:
You asked Wayne: what do you mean by "to reference a cell" ??
The reference is from Cell A2 to Cell A1 through a formula, such as: =A1+1
Regards,
Ian. -
Help with Importing Excel Data into Formatted Tables
This is my first post, here, so please be gentle!
I am a relatively new user of InDesign CS4, and I am creating a 70-pg manufacturer's price book. A very large portion of each page is going to be size and price information imported from a large Excel spreadsheet.
I have created the table format that I'd like to use for each page, but the trouble comes when I import the Excel data into that table. For some reason, when I import, it all dumps into one cell. Would it be best to import as an unformatted table, and then format the table each time, or is there a way to simply import the data into my pre-formatted table? I've seen how the former is done, but the latter seems much easier (...although that could be my inexperience talking).
Any advice would be greatly appreciated!
Thanks so much,
Laura (V1500)Thank you both so much for your time! This is exactly what I needed.
Cheers
Laura -
Address (char type) to excel (date format)
i have address 17-1-1 but after i export to excel it become date format.
how do i solve this prob ?
tks.As ssr has highlighted, this isn't a fault of Oracle but is standard functionality of Excel when importing data. Excel tries to intelligently look at the data and give the cell the correct format based on that data. Because your data looks like a date it assumes it is and will format it as a date according to your nationality settings on your PC.
ssr suggested putting a quote before the data which is the correct thing to do.
If the data is:
'17-1-1rather than
17-1-1Then excel sees the single quote and understands this to mean that you want the format of the data to be "text" rather than "date". -
Excel Table with Data Connection Manual Text Entry Misaligned After Refresh
Greetings!
I have an Excel 2010 workbook that includes a table linked to my SharePoint 2013 site by a data connection. The SharePoint list feeds the table standard information that's managed on the SharePoint site, but I need the user of the Excel workbook to be able
to enter text manually in the workbook to associate local information with the line-items coming from the SharePoint list. To do this, I've added extra columns to the end of the table.
The user can enter information in the appropriate cells in the "extra" columns at the end of the table, but when I refresh the data connection, the addition of a new list item on the SharePoint side results in the user's manually entered text getting
out of alignment with the row it's supposed to be associated with.
Example
Column 1(SP)
Column 2(Extra)
Row 1
Item 1
Row 2
Item 2
Text entered for Item 2
Row 3
Item 3
Then, if I add a new item to the list in SharePoint, for example, something that would appear between the original items 1 & 2, after refreshing the table, I get the following:
Column 1(SP)
Column 2(Extra)
Row 1
Item 1
Row 2
New Item 1.5
Text entered for Item 2
Row 3
Item 2
Row 4
Item 3
The table's data connection is set to insert rows for new items, and I could swear I had this working properly once upon a time...but I can't seem to make it work now.
Any thoughts on what would cause this?
Thanks in advance!Yes, it is. I realized after posting the first time, that I'd assigned the question to the Visio forum. I wasn't sure how to reassign to the correct (Excel) forum, so I re-posted over there:
http://social.msdn.microsoft.com/Forums/en-US/b3bbe00c-94c0-48d4-bed9-fbd08d707b1d/excel-table-with-sharepoint-data-connection-manual-text-entry-misaligned-after-refresh?forum=exceldev -
having a problem with dates when I send my numbers doc to excel. dates are all out and that they have to cut and paste individual entries onto their spreadsheet. Any idea how I can prevent this.
I'm using Lion on an MBP and Numbers is the latest versionMay you give more details about what is wrong with your dates ?
M…oSoft products aren't allowed on my machines but I use LibreOffice which is a clone of Office.
When I export from Numbers to Excel and open the result with LibreOffice, the dates are correctly treated.
To be precise, dates after 01/01/1904 are correctly treated. dates before 01/01/1904 are exported as strings but, as it's flagged during the export process, it's not surprising.
Yvan KOENIG (VALLAURIS, France) mardi 3 janvier 2012
iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My iDisk is : http://public.me.com/koenigyvan
Please : Search for questions similar to your own before submitting them to the community
For iWork's applications dedicated to iOS, go to :
https://discussions.apple.com/community/app_store/iwork_for_ios -
Export to PDF, Excel, Excel (Data Only) formatting issues
Hi Community
I have a report that consists of 5 subreports. Out of the 5 subreports, 3 of them have a similar format whereas the other 2 are different.
Iu2019m currently facing an issue whereby the exports to excel works fine, but excel (data only) has some alignment issues(i.e. the data appears below the correct columns). However, when the report is tweaked to make export to excel (data only) appear correctly, the export to excel had its data shifted out of alignment. There is no impact to pdf exporting at the moment.
Are there any people who are facing similar issues? Is there any resolution or workaround? I appreciate any help. Thanks.
FYI, the version of crystal reports is Crystal reports is Crystal reports 2008 and we are using the crystal report viewer interface to export into excel and pdf formats. The excel version is 2007.
RegardsDW, i've also run into issues with multiple sub reports. I resolved it by putting each sub report into it's own section, and then suppressing the sub report (Note, if ur trying to export subreport data to excel, I don't think its going to work. You'd need to create shared variables and then bring those sub report shared variables into your main report).
Once you bring your shared variables into the main report, suppress your sub reports, and then export to excel, you're still left with a dataset that has missing rows. This is ok. You can solve it easily within the excel file itself by sorting the data on a unique ID like Account #. This removes the extra rows.
Not the most elegant solution, but it works.
Maybe you are looking for
-
I cannot open Pages documents that I have worked on and saved. When I try to reopen Pages documents that I've saved, I get the following message: "The document "[name of document]" could not be opened. The file isn't in the correct format. The file
-
Problems upgrading from 10.2.8 to 10.3.9
I'm having trouble upgrading from 10.2.8 to 10.3.9.. The first install CD won't boot, I get a grey screen and no "blue OS X sign" it just stays grey.. And here is briefly the history of what happened to get me to this point.. This problem is on an iM
-
The Group Policy Client Service Failed The Logon
Hello, When our students login to our Windows 7 machines they are getting this error: The Group Policy Client Service Failed The Logon Access is denied. We are attempting to use both volatile and roaming profiles. The profiles are being stored on the
-
To export pivot table from excel and save as picture using powershell
I am trying to automate my work by attaching an excel file to email and send it across using powershell . But also, I want to paste the screenshot of pivot table to my email body . One way to do it is to save only the pivot table as picture format l
-
Finding duplicate items in item master query
Hi.. I need to find the all duplicate items with same foreign name in Item master data ....Query is needed . Regards, K.Ramasamy