Solved

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

Posted on 2013-10-27
17
179 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 45

Expert Comment

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

Expert Comment

by:[ fanpages ]
Comment Utility
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
Comment Utility
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
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
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 45

Expert Comment

by:Martin Liss
Comment Utility
If MyField = 123 then this

MyField = Format(MyField,"000000000")

Open in new window


will result in MyField being "000000123"
0
 

Author Comment

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

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
there is no code

I can not show you .csv file because of social security numbers
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

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

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
yes teach me a macro
I need to change all the fields in 1 column to be 9 digits
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
Can you post a sample workbook with a few lines of fake data?
0
 
LVL 20

Expert Comment

by:Ejgil Hedegaard
Comment Utility
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
Comment Utility
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 20

Accepted Solution

by:
Ejgil Hedegaard earned 500 total points
Comment Utility
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
Comment Utility
This answer did not work for me but I feel this answer could work for others.  Thanks.
0
 
LVL 20

Expert Comment

by:Ejgil Hedegaard
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now