Formatting strings

S

strawberry

I have a column with the following formula e.g.

=CONCATENATE(B31,C31)

The values in column B are either text or blank. The values in C are
numbers.

The output presently look like this
ColB ColC Result
FF0 5 FF05
5.07 5.07
5.08 5.08
5.09 5.09
5.1 5.1 <-- Note in Excel, ColC actually displays as "5.10" - but
it pastes like this.
5.11 5.11
5.12 5.12

I'd like the Result column to look like this (I don't mind if changes
need to be made to the other columns):
ColB ColC Result
FF0 5 FF05
5.07 5.07
5.08 5.08
5.09 5.09
5.1 5.10 <-- all results formatted to 2 decimal places regardless
of zeros.
5.11 5.11
5.12 5.12
5.11 5.11
5.12 5.12

I've been tearing my hair out playing with custom formats trying to
make this work. Any help greatly appreciated.
 
P

Pete_UK

Try this:

=B31 & TEXT(C31,"0.00")

If you want a space between your text and the number (but no space if
column B is empty), you can do this:

=TRIM(B31 & " " & TEXT(C31,"0.00"))

Note that & does the same as CONCATENATE, but is easier to type.

Hope this helps.

Pete
 
S

strawberry

Try this:

=B31 & TEXT(C31,"0.00")

If you want a space between your text and the number (but no space if
column B is empty), you can do this:

=TRIM(B31 & " " & TEXT(C31,"0.00"))

Note that & does the same as CONCATENATE, but is easier to type.

Hope this helps.

Pete

Pete_UK

Thanks - much better!

It now adds ".00" to the FF0# string - but I think I can live with
that. ;-)

Thanks again.
 
P

Pete_UK

Sorry, I didn't realise that was part of your data. You can overcome
it like this:

=B31 & TEXT(C31,IF(B31="","0.00","0"))

Hope this helps.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top