move first two digit to right

  • Thread starter Thread starter TFMR
  • Start date Start date
T

TFMR

Dear All,

I have a list of nos. 4-12456 and so on. I want to move first two character
to end of cell value like 12456-4.

Thanks & Regards

Hassan
 
Hi,

We could have done with a few more examples but this works for your posted one

=MID(A1,3,LEN(A1))&MID(A1,2,1)&LEFT(A1,1)
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
Dear All,

I have a list of nos. 4-12456 and so on. I want to move first two character
to end of cell value like 12456-4.

Thanks & Regards

Hassan

If you input is in cell A1, try the following in the cell where you
want to have your output:

=RIGHT(A1,LEN(A1)-2)&MID(A1,2,1)&LEFT(A1)

Hope this helps / Lars-Åke
 
Hi Hassan

=MID(A1,3,99)&"-"&LEFT(A1,1)

Note that 99 is just an arbitrary number, which has to be equal to or larger
than your text string less two.

Regards,
Per
 
Thanks Mike,

Its really help me, but there is one more query that if there is only five
digit without hypen "-" then return will be same.
 
Hi,

As I said in my last post

Give examples of before and after and someone will come up with a generic
solution. There is no point in guessing further as to what your data looks
like
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
TFMR said:
Its really help me, but there is one more query
that if there is only five digit without hypen "-"
then return will be same.

You are not being very clear about your requirements. If you strings are
only of the form x-xxxxx and xxxxx, then the following should suffice:

=if(len(A1)=5, A1, mid(A1,3,5) & "-" & left(A1))

Note: Change MID(A1,3,5) to MID(A1,3,99) if strings that start with "x-"
might be longer than 7 characters.


----- original message -----
 
Back
Top