A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

specify data size in cell add 0's



 
 
Thread Tools Display Modes
  #1  
Old June 24th, 2009, 08:25 PM posted to microsoft.public.excel.worksheet.functions
donna13pa
external usenet poster
 
Posts: 1
Default specify data size in cell add 0's

I want to specify that if data I am importing is 5556946581 it will return as
0000005556946580. It will add 0's to the beginning to make the length 16
characters long and also change the last number to 0 if it is a number from
1-9
  #2  
Old June 24th, 2009, 08:36 PM posted to microsoft.public.excel.worksheet.functions
Luke M
external usenet poster
 
Posts: 2,672
Default specify data size in cell add 0's

Something like this:

=TEXT(MID(A2,1,LEN(A2)-1)&0,"0000000000000000")

Note that if you need this to be a number, you can use:
=VALUE(MID(A2,1,LEN(A2)-1)&0)
and just format cells - number tab, custom format of
0000000000000000
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"donna13pa" wrote:

I want to specify that if data I am importing is 5556946581 it will return as
0000005556946580. It will add 0's to the beginning to make the length 16
characters long and also change the last number to 0 if it is a number from
1-9

  #3  
Old June 24th, 2009, 08:41 PM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default specify data size in cell add 0's

Hi,

I'd import your data and leave it as is and convert to the format you want
with a formula. Say you imported to column A, put this in b1 and drag down

=REPT("0",16-LEN(A1))&LEFT(A1,LEN(A1)-1)&"0"

Mike

"donna13pa" wrote:

I want to specify that if data I am importing is 5556946581 it will return as
0000005556946580. It will add 0's to the beginning to make the length 16
characters long and also change the last number to 0 if it is a number from
1-9

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.