Comma Missing When Converting From xls to csv - excel

I have an excel spreadsheet that has two columns. When I choose to save it as a csv file, the comma after the second column is not in place. For example, i get this:
Invoice,SID No.
156106,ELC204R8
156106,WXC2048V
Instead of this:
Invoice,SID No.,
156106,ELC204R8,
156106,WXC2048V,
How to I get the comma in right before the line break?

This as I assume you are aware is not a usual requirement/format for saved CSV file.
To achieve what you are trying to do though, you need to trick Excel into thinking you are exporting a third blank/empty column.
One way to do this is to add the single-quote character ' into a third Excel column before exporting.

I just entered a space into the first 20 rows and that solved the issue.

Related

change cell format to general or text?

we have sort of data in excel like this ---> 34:5:20
excel likes to consider it as time or date.
here is the problem because I know it's not a date and what ever action I want to do with it again
excel thinks it's a date/time value .
how can I stop this behavior ?
(each of the ':' delimited values has a special meaning to me but not date/time)
thanks a lot.
There is one option though, you can use the formula below, to convert the dates back to your format
=CONCAT(" ",TEXT(A2,"[h]:mm:ss"))
I am adding a space using concat function just so that if you ever decide to convert all to value, it will not return back to dates
I found the solution finally .
copy column to notepad.
select another column
change it's format cell to text.
now paste from notepad.
now my data is considered as text and I can separate the values using "column to text" from DATA tab.
thank you all for your valuable time.

EXCEL to CSV (VBA)

I need to export a Excel sheet to cdv (easy) but I need to have this format for numbers:
102.682,35
and my csv file is doing this:
3928.5400000000027
I need to have thousands quote separator.
any idea?
Two things here. If the CSV will be imported back into an Excel spreadsheet, then having a comma as a thousands separator is a visual format issue. This means that it can be formatted to show the thousands comma once it's back in Excel. In this case, don't worry about adding a thousands comma to the CSV file, just make sure to format the cells later.
Secondly, if you really do need a thousands comma in the CSV file you can do this yourself with VBA by learning how to create a loop over your data range and write to a text file in the CSV format. Now the thing about CSV is that the "separator" doesn't have to be a "comma" (even though CSV means "comma separated values"). You can choose any character that won't be used within any value.
Typically you'd do this if a comma is likely to appear in a value such as a string:
This is a sentence, but it has a comma embedded within it.
In your case you want a comma in a number value 133,491.234. So for the separator in a CSV file, choose another character such as the vertical pipe |. Now the values in the CSV file would look like this:
Doctor|Smith, John|$142,533|Brown Eyes
Look at this website to learn to Write Data to Text File and when you're looping over the cell values and come to the value that needs the thousands comma, use the Format function similar to this:
Format(cellValue, "#,##0.00")

How to remove hidden quotes on numbers in excel that prevent changing the format

I have copied several columns of data with ~85 rows from a webpage system that my company uses. One column of numbers copied over with no issues, but the other (and more important) column contains hidden quotes surrounding the numbers. I cannot change format, nor add the numbers, etc.
I have tried using =value(mid(cell,1,len(cell)-1)) to remove the quotes, and have also tried using substitute, with no success.
Does anyone know of another possible solution to try?
Thanks!
Saw the file as csv format. Close it and reopen in csv. It will show all the hidden quotations. Then use text to column and remove the special characters.

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!

Consistent commas in Excel CSV

In Excel, let's say I have 5 columns, but not all of the time will a column have data.
How can I force it to give a static number of commas?
I end up having some rows like this (as I would like it):
Field1,field2,field3,field4,field5
field1,field2,,,
Then some rows like this:
field1,field2,field3,field4,field5,
field1,field2,
field1,field2,field3,field4,
you mean when exporting? That should happen by default. I tried it just now with Excel 2007 and all exported lines in the .csv-file had the same amount of commas. Those lines with fewer columns had extra commas at the end, just like in your example
Actual exported excel file:
hello;world;;;;
how;are;you;doing;;
hi;;;;;
welcome;to;;;;
the;jungle;;;;
some;line;with;lots;of;columns
The actual amount of commas is determined by the row with the most columns
So in this particular instance, there was a lot of copy pasting going on to create the file.
I finally opened a new worksheet, copied the entire document over, and created a CSV using that.
This resolved my problem.

Resources