Custom Format for Text

C

CraigH

Current Desired
1234567-4 1234567-0004
1234567-24 1234567-0024
M485743895A M485743895A
 
C

CraigH

Very helpful...thank you.
-----Original Message-----
Assuming â?~Current Valueâ?T in cell A1.

The IF & ISERROR function evaluates whether the Current Value has a hyphen
in it.
â?¢ If ISERROR is true (no hyphen), then return the Current Value.
â?¢ If ISERROR is true (hyphen exsists), then use the REPLACE Function to
find the hyphen and replace the hyphen with a new string that is cut up and
put together with the LEN, LEFT, RIGHT, FIND, and CONCATENATE functions.

=IF(ISERROR(FIND("-",A1)),A1,REPLACE(A1,FIND("-",A1) +1,4,CONCATENATE(LEFT("0000",12-LEN(A1)),RIGHT(A1,LEN(A1)-
FIND("-",A1)))))

Hope this Helps!
Camilo

Objective: To help one person each day!

Feedback is greatly appreciated! Please let me know if I've answered your
question or if my post was helpful to you?


.
 

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