How can i convert format cells of csv file using notepad? - excel

i am trying to create file of csv extension but i want to format it with with notepad the problem is a column includes phone numbers and the numbers start with 010******* and when i try to open it in excel it consider the column is a number value so it removes the 0 (10*******) i want to format the cell as a string value.
i tried adding "01********" but the same problem happened.
the code is :
email,phone
example#company.com,01123456789
example2#company.com,0121223456789

Related

Problem with numbers in csv file in Excel

I downloaded the csv version of the table present in this web-page https://d-place.org/parameters/DistToCoast_km#1/30/152. In the online version of the table the first column looks like this:
0.046161698
0.046405053
0.102112618
0.102112618
2,047.307804
2,029.644235
but when I open the csv file in Excel, these values look like this:
46161698
46405053
102112618
102112618
2047307804
2029644235
Can anyone tell me how to get a file usable in Excel in which first column values are the same of the first column online version and also look the same?
you have to separate spaces with commas,
like column1,column2,column3
in your case i assume you have only 1 column like this
value1
value2
...
value n
in between the value you should not put any comma, otherwise it will be interpreted as a new column.
and your error was also that you didnt formatted excel sheets to display decimal numbers, so it cut out the zeros.
you have 2 ways:
you should format cells as text
format cells as decimal numbers
I opened the csv file directly clicking on it, without opening Excel before and clicking on Data > From text and importing the file. After opening the csv file clicking on it, Excel starts and the spreadsheet looks like this:
The I click on Data > Text to Columns > Delimiters: Comma, then I specify in the advanced settings that Decimal separator is ".", while Thousands separator is ",". After this passages, spreadsheet looks like this:

Excel cell format - #/# - converts to data automatically

I am putting together a list of data and some of that data is in the following format
('#/#' - # single digit numeral. Example 1/1 however excel automatically interprets it as 1/1/2020. I have tried researching customer excel cell formats:
?"/"? or 0"/"0
None seem to work excel returns the following
4383/1
Any ideas on how can I format the cells to recognize #/# without converting the text?

keep leading zeros when I add quotation mark in excel

I have a list of SSN in my excel file (9 digits, some of which have leading zeros, no hyphen).
I keep them in the special format (numero da seguranca social in portugues) so I can keep leading zeros in the column.
I want to add ' ', to the column so that I can search them in SQL query in bulk.
When I use concatenating formula ( concatenating("'",B2,"'",",")), the leading zeros are gone.
How can I achieve the result of 00XXXXXX as '00XXXXXX', ?
Thank you!
I am not sure what your special format is, but I am guessing that if the value is xx the format makes it look like 00xx. Similar to a zip code.
So the value when you change it to text looks like xx.
I can think of 2 ways to fix it
Write a formulae which basically does what the special format does. For example it would make xx as 00xx. Then you can concatenate this new value like u mentioned earlier
Copy the values from excel to notepad and then paste it to excel again. When you copy from excel to notepad, the formatted value, i.e. 00xx will get copied to notepad which can then be pasted to excel in a separate unformatted cell.
One way of doing this is to copy your SSN column from your file and paste it into a new file all by itself. Then, while ensuring that the SSN numbers are formatted with any appropriate leading zeros, save the new file as a text/tab delimited file and close it. Now, using Excel's Open File command, select your text file and on Step 3 of 3, select Text for the Column data format. Now, you should be able to select that column of data and copy it back to your main file and perform your concatena
Did you try ''00XXXXXX' or "'00XXXXXX"? That is, add one single quote before the number and Excel interprets it as a string, not a number. If you will not do any numeric operations with it, then it should be a string.
Thank you all for your input.
I ended up using #tigeravatar 's method, which is
="'"&TEXT(B2,"000000000")&"'"&","
and it worked for me.
Thank you!

csv is converting numbers in excel to date or text instead of numbers

I am automatically generating csv from the SQL server.
Some users have problem that excel automatically converts some numbers to date.
If the value is not converted to date, then it is formated as txt.
When I open the file it is shown ok = without text or date = just as number..
Dont you know how it can be fixed?
Thanks.
Select the single column you want to convert -> Data-> Text To Columns
In the Text to Column Wizard hit Delimited and Next -> Next
In the Column data Format section select "General" press Finish.
This will convert text to numeric values.
Hope that helps!
the problem lied in a regional settings.

Excel wrong timestamp format recognition

I am trying to open a CSV file which contains a column named ts which has timestamp in the following pattern throughout the file:
12/31/2016 20:40
mm/dd/yyyy hh:mm
Now when I open this in Excel, some of them are getting recognized some not.
The problem seems to be that Excel is automatically recognising it in dd/mm/yyyy hh:mm format so when a date is 11/13/2016 0:00, it is unable to recognise it(because of 13th Month).
How to fix this?
You'll find that even when Excel is recognizing dates, it's getting the months and days back to front.
When opening a .csv file directly (e.g. by double clicking it from Windows Explorer or choosing File > Open from within Excel), Excel will try to parse any dates according to your local time format. The only way to change how dates are parsed when opening a file directly is to change your local time format, which you probably don't want to do.
The workaround is to open the file from within Excel using the Text Import Wizard, where you can explicitly state the format in which dates have been stored in the text file.
Open a new workbook
Go to the Data tab; in the Get External Data group, click From Text
Select your file and click Import
Step 1: Choose Delimited and select Next
Step 2: If it's a true .csv, choose Comma as your only delimiter. (Note that quite often, data exported from other systems is tab-delimited rather than comma separated. However, the .csv file extension is still used to indicate that the file is opened in Excel (or similar). If choosing Comma isn't splitting your columns correctly, try choosing Tab as your delimiter instead. When your data has been split into columns correctly, press Next.)
Step 3: Select the column that has dates, then set the Column data format to Date and in the drop down, choose MDY. It should look like this:
Click Finish
Choose where you want the data to go and click OK
You should now have the data open, with the dates correctly interpreted and also displaying in your local date format (dd/mm/yyyy).
If you want to keep the full date and time in one column, then additional work is required because there's no way of telling Excel to correctly interpret a date/time string that doesn't match your local format.
Start by following the above steps, but at step 6, choose Text as the data format instead. This is necessary to ensure Excel doesn't try to interpret any dates (where day is less than 12).
Then, if your dates are always in mm/dd/yyyy hh:mm format (including leading zeroes for single digit days, months and hours), then the following formula will convert a date/time string that is in cell A1 to a date/time serial that you can format and work with as normal:
=DATE(MID(A1,7,4),LEFT(A1,2),MID(A1,4,2)) + TIMEVALUE(RIGHT(A1,5))
This is happening because the output date you got is in text format, not in date format. Here is the trick to resolve your case to get the output in mm/dd/yyyy hh:mm format. You can change the format to your desired one.
If text date is in A column, then formula is -
=DATE(MID(A3,SEARCH("/",$A3,SEARCH("/",$A3,1)+1)+1,4),LEFT(A3,SEARCH("/",A3,1)-1),MID($A3,SEARCH("/",$A3,1)+1,SEARCH("/",$A3,SEARCH("/",$A3,1)+1)-SEARCH("/",$A3,1)-1))+TIME(HOUR(RIGHT(A3,LEN(A3)-SEARCH(" ",A3,1))),MINUTE(RIGHT(A3,LEN(A3)-SEARCH(" ",A3,1))),SECOND(RIGHT(A3,LEN(A3)-SEARCH(" ",A3,1))))
Hope this helps. Rate if satisfied. :)
I've left the Text Import Wizard approach as a separate answer, because it has some useful info. However, I've realized that if we're heading down the path of needing to use a formula, then we might as well just use a formula after opening the file normally!
The following formula works on all date/times that were stored as mm/dd/yyyy hh:mm
=IF(ISNUMBER(A1),DATE(YEAR(A1),DAY(A1),MONTH(A1))+A1-INT(A1),DATE(MID(A1,7,4),LEFT(A1,2),MID(A1,4,2)) + TIMEVALUE(RIGHT(A1,5)))
The formula first checks whether Excel has interpreted the value as a date, which happens when the day is less than or equal to 12. If it has, then Excel has swapped day and month, so the formula swaps them back. Alternatively, if Excel hasn't interpreted the value as a date (which happens when the day is greater than 12), it will still be text and a date/time is generated after rearranging the text string.

Resources