Kelly
Kelly

Reputation: 145

How to concatenate with a leading zero in number less than 10

I have an hour and a minute column in my dataset. I want to concatenate them so that there is a "." in between. In cases where the minute column is less than 10, I want to add a leading zero.

Example of what I want it to look like:

Hour(A): 1
Minute (B): 2
Desired Outcome (C): 1.02

I have been playing with this formula Con (A,”.”, IF (Len (B) =1, con (0, B), B)) but I can't seem to make it work

Can anyone give any insight?

Upvotes: 1

Views: 1276

Answers (2)

user4039065
user4039065

Reputation:

Put this formula in column C,

=time(a1, b1, 0).

Format the cell as h.mm.

enter image description here

Upvotes: 1

CallumDA
CallumDA

Reputation: 12113

Try this:

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

Or this also works:

=TEXT(TIME(A1,B1,0),"h.mm")

As required:

enter image description here

Upvotes: 3

Related Questions