Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do you take (A1) 123456xxxx and pull out the last four digits from another cell such as (A2) 887890, grabbing just the 7890 - result of 1234567890, or even better, 123-456-7890?

share|improve this question
1  
have you tried using a regular expression - superuser.com/questions/181005/… –  kavun Jan 10 '13 at 15:23

1 Answer 1

=LEFT(A1,3)&"-"&MID(A1,4,3)&"-"&RIGHT(A2,4)

For further information on how any of the three Excel functions LEFT, RIGHT and MID work, have a read of this.

share|improve this answer
1  
Where does this formula go? We're looking for long answers that provide some explanation and context. Don't just give a one-line answer: please explain why you're recommending it as a solution and how to implement it. –  CharlieRB Jan 10 '13 at 15:58
2  
Sorry, thought it was obvious given the Excel context. This is a formula which can go in any cell to give you the output requested. For further information on how any of the three Excel functions LEFT, RIGHT and MID work, have a read of this: techrepublic.com/article/… –  Andi Mohr Jan 10 '13 at 16:02
    
No reason to be sorry. I am just trying to help you give more complete answers. It is a good idea not to assume anything. Think about the people who will read this a question; will readers understand how to apply your answer? –  CharlieRB Jan 10 '13 at 16:13
    
Yep, makes sense. Thanks for the edit :) –  Andi Mohr Jan 10 '13 at 16:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.