ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Field length in Cells (https://www.excelbanter.com/excel-programming/302114-field-length-cells.html)

apv98

Field length in Cells
 
Hi,

I am very new to this forum. I have two queries:

1. I have got data in various columns in a work sheet. Each colum
contains data from a table(outside excel). I want to copy all the dat
in a row to one cell. This I acheived through the formula = A1 & B1--
etc. However I want to maintain the field length of each too. Fo
example the first field in my excel file represents a field which is 2
characters long and the next 10 characters long. The data for the firs
field is abcd and for the second is 1234.

What I want in the cell is ABCD 1234

Is it possible in excel to do this?

Thanks & regards,
Pau

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Field length in Cells
 
to right justify
=rept(" ",10-len(trim(a1)))&trim(a1)&rept(" ",10-len(trim(b1))) & trim(B1)

to left justify
=trim(a1)&rept(" ",10-len(trim(a1)))&trim(B1)&rept(" ",10-len(trim(b1)))

--
Regards,
Tom Ogilvy


"apv98 " wrote in message
...
Hi,

I am very new to this forum. I have two queries:

1. I have got data in various columns in a work sheet. Each column
contains data from a table(outside excel). I want to copy all the data
in a row to one cell. This I acheived through the formula = A1 & B1---
etc. However I want to maintain the field length of each too. For
example the first field in my excel file represents a field which is 20
characters long and the next 10 characters long. The data for the first
field is abcd and for the second is 1234.

What I want in the cell is ABCD 1234

Is it possible in excel to do this?

Thanks & regards,
Paul


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 06:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com