-2

I have an Excel file containing in 4 columns:

hours   minutes seconds milliseconds
9         7          51       905
9         7          58       233

How can I put one row of this data into a single cell? My aim is to create a single cell containing hh_mm_ss.000 in order to make calculations.

No VBA, Excel functions preferred. Thanks.

The solution I found

1) concatenate data

=CONCATENATE(H2;":";I2;":";J2;".";K2)

2) convert to milliseconds

=(H2*3600+60*I2+J2)*1000+K2

3) computations

4) result back to seconds (=cell/1000) [format cell as general]

Luke
  • 53
  • 6

2 Answers2

1

You can concatenate strings using the CONCATENATE() function in Excel:

=CONCATENATE(A1, "_", B1, "_", C1, ".", D1)

If you use a non-English version of Excel, use semicolons instead:

=VERKETTEN(A1; "_"; B1; "_"; C1; "."; D1)

As arguments you can either use static strings or reference cells.

Furthermore, you can provide as many arguments as desired, to concatenate them. You are not limited to two arguments.

user1438038
  • 5,821
  • 6
  • 60
  • 94
0

If calculations such as adding/subtracting times are required, probably easiest solution would be to convert all times to seconds and add them up.

For example,

= 3600*A1+60*B1+C1+D1/1000

I would say this is required to do manually because Excel's built in time system only has a resolution down to the second (not millisecond).

ImaginaryHuman072889
  • 4,953
  • 7
  • 19
  • 51