Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Creating sequential text string of fixed length

Hi - I need a formula that will generate text strings in rows like

row 1 0001
row 2 0002
row 3 0003
..
..
..
row 9999 9999

I want the leading zeros and I can't figure out what value to use in the
Text formula to get that to work. Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,389
Default Creating sequential text string of fixed length

Try:

=Text(row(),"0000")

Regards,
Fred.

"dhstein" wrote in message
...
Hi - I need a formula that will generate text strings in rows like

row 1 0001
row 2 0002
row 3 0003
.
.
.
row 9999 9999

I want the leading zeros and I can't figure out what value to use in the
Text formula to get that to work. Thanks for your help.


  #3   Report Post  
Posted to microsoft.public.excel.misc
BDT BDT is offline
external usenet poster
 
Posts: 13
Default Creating sequential text string of fixed length

Try:

=Text(row(),"0000")


That didn't work for me, but this did

Put Row 1 0001 in Col B
Put 0001 in Col C
Put function =RIGHT(B2,4) in Col D
Put function =CONCATENATE(C2," ",D2) in Col E
Copy down 9999 rows

Use Copy & Paste Special/Values to put Col E info into an empty column and
delete Cols B thru E.

It's not very elegant, but it does the job quick and EZ.

good luck
  #4   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Creating sequential text string of fixed length

=Text(row(),"0000")
That didn't work for me


I'm quizzical. Fred's suggestion works ok for me, and it should for you,
too, as long as its placed in any cell in row1, then copied down from there
(since ROW() is sensitive to the row it is placed in).

What exactly did the expression return for you?

For increased flexibility to start with 0001 in any cell, just apply a small
tweak
In any starting cell, say, in B3: =TEXT(ROWS($1:1),"0000")
Copy down
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---
  #5   Report Post  
Posted to microsoft.public.excel.misc
BDT BDT is offline
external usenet poster
 
Posts: 13
Default Creating sequential text string of fixed length

Here is a better solution than the one I suggested earlier.

Try =CONCATENATE("Row ", ROW(), " ", TEXT(ROW(),"0000"))

then you can copy the row and Paste Special/value over itself to remove
all of the functions so it doesn't stay linked to the row number. It's just
text at that point.

hope this helps

"dhstein" wrote:

Hi - I need a formula that will generate text strings in rows like

row 1 0001
row 2 0002
row 3 0003
.
.
.
row 9999 9999

I want the leading zeros and I can't figure out what value to use in the
Text formula to get that to work. Thanks for your help.



  #6   Report Post  
Posted to microsoft.public.excel.misc
BDT BDT is offline
external usenet poster
 
Posts: 13
Default Creating sequential text string of fixed length

Hi Max and Fred. I was taking the question too literally. I was trying to
generate the whole thing .... Row 5 0005 , not just the 0005 .

Sorry if I confused the issue. Fred's earlier solution gave me something to
use to build a function for the whole thing that I posted a moment ago.

cheers,

"Max" wrote:

=Text(row(),"0000")

That didn't work for me


I'm quizzical. Fred's suggestion works ok for me, and it should for you,
too, as long as its placed in any cell in row1, then copied down from there
(since ROW() is sensitive to the row it is placed in).

What exactly did the expression return for you?

For increased flexibility to start with 0001 in any cell, just apply a small
tweak
In any starting cell, say, in B3: =TEXT(ROWS($1:1),"0000")
Copy down
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Creating sequential text string of fixed length



"BDT" wrote:

Here is a better solution than the one I suggested earlier.

Try =CONCATENATE("Row ", ROW(), " ", TEXT(ROW(),"0000"))

then you can copy the row and Paste Special/value over itself to remove
all of the functions so it doesn't stay linked to the row number. It's just
text at that point.

hope this helps

"dhstein" wrote:

Hi - I need a formula that will generate text strings in rows like

row 1 0001
row 2 0002
row 3 0003
.
.
.
row 9999 9999

I want the leading zeros and I can't figure out what value to use in the
Text formula to get that to work. Thanks for your help.


Thanks for all the responses - the documentation on TEXT is a little sparse
and hard to find the "0000" which was what I needed.
  #8   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Creating sequential text string of fixed length

Please take a moment to press the YES button (like the one below) in ALL
responses which helped to answer your query
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---
"dhstein" wrote:
Thanks for all the responses - the documentation on TEXT is a little sparse
and hard to find the "0000" which was what I needed.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text to column fixed length Luci Excel Discussion (Misc queries) 6 November 27th 08 06:27 PM
Fixed Length, Text Formatted Novice2000 Excel Discussion (Misc queries) 2 May 13th 08 06:06 PM
creating numbers to a fixed length string... ds Excel Worksheet Functions 4 July 5th 07 01:06 AM
Fixed length text file Eric Excel Discussion (Misc queries) 1 July 12th 06 10:02 PM
fixed string length,even other record is copied viv Excel Discussion (Misc queries) 0 May 30th 05 08:28 PM


All times are GMT +1. The time now is 04:49 AM.

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

About Us

"It's about Microsoft Excel"