#1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Concatenate Problem

Hi,

I don't know much about macros in excel but have used a few from the
postings from this group I am trying to create FIPS code for
counties, the way I have the data, the state code is given by
1,2,3....50, the county codes are 1, 2,3....15...100. To make a fips
code the state code 2 digits (i.e. if the code is 1 it has to be made
02) and the county code in 3 digits i.e. if its 1 it has to be made
001, are joined, so a county with state code 1 and county code 1 will
have a fips code of 01001, with county code 22 will have a fips code
of 01022 and so on. The way I am trying to do is I am recording a
macro by first converting the state column to 00 format and then
converting the county column to 000 format, inserting a new column-
FIPS, formating the fips column to 00000 and then concatenating the
state and county column, using CONCATENATE function in the new column,
the problem is that during concatenation excel removes the trailing 0,
ie if I concatenate 01 and 001, the result is 11 though I want it to
be 01001 ie 5 digits, it does not work even if I format the fips
column to 00000. Can anyone please advise how to do this using a macro
or some other script so that after concatenation the fips code will be
5 digits?

thanks

Singh

  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel
external usenet poster
 
Posts: 347
Default Concatenate Problem

Hi,

Not a macro but you can use a formula like this:

=TEXT(A1,"00")&TEXT(B1,"000")

HTH
Jean-Guy

"singh" wrote:

Hi,

I don't know much about macros in excel but have used a few from the
postings from this group I am trying to create FIPS code for
counties, the way I have the data, the state code is given by
1,2,3....50, the county codes are 1, 2,3....15...100. To make a fips
code the state code 2 digits (i.e. if the code is 1 it has to be made
02) and the county code in 3 digits i.e. if its 1 it has to be made
001, are joined, so a county with state code 1 and county code 1 will
have a fips code of 01001, with county code 22 will have a fips code
of 01022 and so on. The way I am trying to do is I am recording a
macro by first converting the state column to 00 format and then
converting the county column to 000 format, inserting a new column-
FIPS, formating the fips column to 00000 and then concatenating the
state and county column, using CONCATENATE function in the new column,
the problem is that during concatenation excel removes the trailing 0,
ie if I concatenate 01 and 001, the result is 11 though I want it to
be 01001 ie 5 digits, it does not work even if I format the fips
column to 00000. Can anyone please advise how to do this using a macro
or some other script so that after concatenation the fips code will be
5 digits?

thanks

Singh


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Concatenate Problem

On Feb 9, 1:01 pm, pinmaster
wrote:
Hi,

Not a macro but you can use a formula like this:

=TEXT(A1,"00")&TEXT(B1,"000")

HTH
Jean-Guy

"singh" wrote:
Hi,


I don't know much about macros in excel but have used a few from the
postings from this group I am trying to create FIPS code for
counties, the way I have the data, the state code is given by
1,2,3....50, the county codes are 1, 2,3....15...100. To make a fips
code the state code 2 digits (i.e. if the code is 1 it has to be made
02) and the county code in 3 digits i.e. if its 1 it has to be made
001, are joined, so a county with state code 1 and county code 1 will
have a fips code of 01001, with county code 22 will have a fips code
of 01022 and so on. The way I am trying to do is I am recording a
macro by first converting the state column to 00 format and then
converting the county column to 000 format, inserting a new column-
FIPS, formating the fips column to 00000 and then concatenating the
state and county column, using CONCATENATE function in the new column,
the problem is that during concatenation excel removes the trailing 0,
ie if I concatenate 01 and 001, the result is 11 though I want it to
be 01001 ie 5 digits, it does not work even if I format the fips
column to 00000. Can anyone please advise how to do this using a macro
or some other script so that after concatenation the fips code will be
5 digits?


thanks


Singh


Thanks a lot, this works, but is there any way I can apply this to the
whole column without having to drag the formula down till the last
row..I have more than 3000 rows in over 150 tables, thats the reason
I was thinking this may be possible with macro or a script..

Singh

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 347
Default Concatenate Problem

If you have data in the adjacent cells then you can double click the drag
icon. It will copy until the first empty adjacent cell.

HTH
Jean-Guy

"singh" wrote:

On Feb 9, 1:01 pm, pinmaster
wrote:
Hi,

Not a macro but you can use a formula like this:

=TEXT(A1,"00")&TEXT(B1,"000")

HTH
Jean-Guy

"singh" wrote:
Hi,


I don't know much about macros in excel but have used a few from the
postings from this group I am trying to create FIPS code for
counties, the way I have the data, the state code is given by
1,2,3....50, the county codes are 1, 2,3....15...100. To make a fips
code the state code 2 digits (i.e. if the code is 1 it has to be made
02) and the county code in 3 digits i.e. if its 1 it has to be made
001, are joined, so a county with state code 1 and county code 1 will
have a fips code of 01001, with county code 22 will have a fips code
of 01022 and so on. The way I am trying to do is I am recording a
macro by first converting the state column to 00 format and then
converting the county column to 000 format, inserting a new column-
FIPS, formating the fips column to 00000 and then concatenating the
state and county column, using CONCATENATE function in the new column,
the problem is that during concatenation excel removes the trailing 0,
ie if I concatenate 01 and 001, the result is 11 though I want it to
be 01001 ie 5 digits, it does not work even if I format the fips
column to 00000. Can anyone please advise how to do this using a macro
or some other script so that after concatenation the fips code will be
5 digits?


thanks


Singh


Thanks a lot, this works, but is there any way I can apply this to the
whole column without having to drag the formula down till the last
row..I have more than 3000 rows in over 150 tables, thats the reason
I was thinking this may be possible with macro or a script..

Singh


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
Concatenate question nick Excel Worksheet Functions 3 July 28th 06 12:40 AM
Excel Startup Problem aussievic Excel Discussion (Misc queries) 1 June 12th 06 05:33 PM
Problem with MS Community Newsgroups? [email protected] Excel Discussion (Misc queries) 4 May 14th 06 05:38 PM
Freeze Pane problem in shared workbooks JM Excel Discussion (Misc queries) 1 February 1st 05 01:04 AM
label problem Raven Maniac Excel Worksheet Functions 5 November 10th 04 11:10 PM


All times are GMT +1. The time now is 05:22 AM.

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

About Us

"It's about Microsoft Excel"