Solved

but this feature will not be preserved if I save as .csv

Posted on 2013-10-27
17
200 Views
Last Modified: 2013-11-11
want all the fields in a column to be 9 digits

some numbers are
67
want

00000000000067

tried column change in microsoft excel 2007

but will not save because I need to convert to .csv




Click the [Number] tab if not already shown, & select the "Custom" Category.

For 9 digits, enter a Type of:
000000000

Confirm with the [OK] button.

PS. I note that your question asks for "9 digits" but you then state:
00000000000067

(14 digits)

If you do want 14 digits, enter a Type of:
00000000000000


but this feature will not be preserved if I save as .csv
0
Comment
Question by:rgb192
  • 7
  • 5
  • 3
  • +1
17 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39604352
Format it like this and then save it.
MyField = Format(MyField,"000000000")
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39604353
As I posted in your previous question:

[ http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_28278500.html#a39604348 ]

In order to maintain leading zero(e)s within Comma Separated Value [CSV] format files, the respective columns (fields) will be required to be enclosed within quotes.

For example...
---
"00000000000067", "second column row 1"
"00000000000123", "second column row 2"
"00000000004567", "second column row 3"
---

If you wish to create CSV files with numeric fields in this manner, then you will need a bespoke file creation routine such as this:

[ http://www.mcgimpsey.com/excel/textfiles.html#fixedfield ]
0
 

Author Comment

by:rgb192
ID: 39604359
Format it like this and then save it.
MyField = Format(MyField,"000000000")

how do I get to this screen



fanpages
I type
format
000000000
and this works

but when I save as .csv
the feature will not be preserved

"000000000"
does literally 9 0s for every field in the column

I would show screenshot but these are social security numbers


problem is some social security numbers  begin with a leading 0 which have been dropped off

I need to upload to a computer program as a csv not xls or xlsx
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 39604361
how do I get to this screen

[CTRL]+[1] key combination, again, as mentioned in your previous thread:

[ http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_28278500.html#a39604336 ]
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39604364
If MyField = 123 then this

MyField = Format(MyField,"000000000")

Open in new window


will result in MyField being "000000123"
0
 

Author Comment

by:rgb192
ID: 39604382
I press ctrl +1
but I do not know where to copy paste
MyField = Format(MyField,"000000000")
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39604386
I do not know where to copy paste
MyField = Format(MyField,"000000000")
Please post the code you use to create the CSV file and I'll modify it.
0
 

Author Comment

by:rgb192
ID: 39604391
there is no code

I can not show you .csv file because of social security numbers
0
 

Author Comment

by:rgb192
ID: 39604397
highlighted all cells in a column
number->custom
copy pasted into textbox
MyField = Format(MyField,"000000000")
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39604423
there is no code
Sorry, my misunderstanding. I thought you were doing this with a macro (which could be done). Let me know if you're interested.
0
 

Author Comment

by:rgb192
ID: 39604428
yes teach me a macro
I need to change all the fields in 1 column to be 9 digits
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39604460
Can you post a sample workbook with a few lines of fake data?
0
 
LVL 21

Expert Comment

by:Ejgil Hedegaard
ID: 39604491
It don't require a macro, you can do it with a formula.
Value in A1, formula in B1
=REPT(0,9-LEN(A1))&A1
Then 67 will be 000000067 in B1, 9 characters with leading zeros.
Copy formula down and copy all values in column B to a new workbook or another sheet. Insert as values.
Then save the sheet as csv , and the format 000000067 will be preserved. in the csv file.
You can open in Notebook to check.
If you open from windows, Excel convert to 67, so use data import, and set the field to text and it will be 000000067.
0
 

Author Comment

by:rgb192
ID: 39604534
It don't require a macro, you can do it with a formula.
Value in A1, formula in B1
=REPT(0,9-LEN(A1))&A1


which textbox do I type this

do I copy paste
0
 
LVL 21

Accepted Solution

by:
Ejgil Hedegaard earned 500 total points
ID: 39606048
No textbox, type the formula in the cell, and then you copy paste.

With the values in column A, starting in A1, then insert the formula in cell B1.
Copy the formula in cell B1 down to the last value in column A.
The easy way is to double-click the black spot in the lower right corner of the cell marker.
Open a new workbook to have a place for the result.
Go back to the workbook with the values, mark all cells from B1 down to last value, and copy.
Switch to the new workbook, with the cell marker in A1, right-click on A1, select Paste special, and select Values in the dialog, then Ok.
Go to Save As and select Other Formats.
Insert a Filename, and in the Filetype box below the Filename box, click on the arrow at the right, scroll down to find CSV, and select that.
You get 2 warnings, accept both.
Close the file.
0
 

Author Closing Comment

by:rgb192
ID: 39639664
This answer did not work for me but I feel this answer could work for others.  Thanks.
0
 
LVL 21

Expert Comment

by:Ejgil Hedegaard
ID: 39640034
Strange it did not work for you, I have done it several times.
If possible, upload a workbook and I will make the csv file.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question