ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date format and concatenation (https://www.excelbanter.com/excel-programming/338543-date-format-concatenation.html)

Sandy

Date format and concatenation
 
Hello -

I have info in two cells that needs to be concatenated into one cell (Cell
E30) as follows:

(Some 8-digit number)(hyphen)(date in format of yyddmm).xls
An example would be 87654321-052808.xls

The 8-digit number is in cell H16 and the date is in cell H18. The format
for the date cell is set at dd/mm/yyyy.

I've tried putting this into a function, but keep getting errors.

Any suggestions will be immensely appreciated.
--
Sandy

Doug Glancy

Date format and concatenation
 
Sandy,

Range("E30") = Range("H16") & "-" & Format(Range("H18"), "yyddmm") & ".xls"

hth,

Doug

"Sandy" wrote in message
...
Hello -

I have info in two cells that needs to be concatenated into one cell (Cell
E30) as follows:

(Some 8-digit number)(hyphen)(date in format of yyddmm).xls
An example would be 87654321-052808.xls

The 8-digit number is in cell H16 and the date is in cell H18. The format
for the date cell is set at dd/mm/yyyy.

I've tried putting this into a function, but keep getting errors.

Any suggestions will be immensely appreciated.
--
Sandy




Ron Rosenfeld

Date format and concatenation
 
On Sat, 27 Aug 2005 19:29:01 -0700, "Sandy"
wrote:

Hello -

I have info in two cells that needs to be concatenated into one cell (Cell
E30) as follows:

(Some 8-digit number)(hyphen)(date in format of yyddmm).xls
An example would be 87654321-052808.xls

The 8-digit number is in cell H16 and the date is in cell H18. The format
for the date cell is set at dd/mm/yyyy.

I've tried putting this into a function, but keep getting errors.

Any suggestions will be immensely appreciated.


Assuming you want the number from H16 to always have 8 digits (i.e. add leading
0's if necessary) and that the value in H18 is a real Excel date, then:

=TEXT(H16,"00000000\-")&TEXT(H18,"YYDDMM")&".xls"


--ron

Sandy

Date format and concatenation
 
Hi Doug and Ron -

Thanks to both of you. Both solutions work beautifully!

--
Sandy


"Sandy" wrote:

Hello -

I have info in two cells that needs to be concatenated into one cell (Cell
E30) as follows:

(Some 8-digit number)(hyphen)(date in format of yyddmm).xls
An example would be 87654321-052808.xls

The 8-digit number is in cell H16 and the date is in cell H18. The format
for the date cell is set at dd/mm/yyyy.

I've tried putting this into a function, but keep getting errors.

Any suggestions will be immensely appreciated.
--
Sandy



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

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