Click here to Skip to main content
15,913,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For Example

12-1234567-43-45 i want 1234567
12-1276556387-35-34 i want 1276556387

Please help for me how to get mid value from different char.,
Posted

1 solution

Assuming the value is in cell A1 and the leading and trailing substrings are of fixed length, try this formula:
=MID(TRIM(A1),4, LEN(TRIM(A1))-9)

Reference: http://www.excel-easy.com/functions/text-functions.html[^]
+++++[Round 2]+++++
=LEFT(TRIM(MID(TRIM(A1),FIND("-",A1)+1,LEN(TRIM(A1)))),FIND("-",MID(TRIM(A1),FIND("-",A1)+1,LEN(TRIM(A1))))-1)

Reference: http://www.techrepublic.com/article/using-excels-find-and-mid-to-extract-a-substring-when-you-dont-know-the-start-point/[^]
 
Share this answer
 
v7
Comments
safihur Rahuman 7-Jun-15 2:38am    
Dear friend, Thank you for Your Replay.,
but substring is not fixed length.,
Peter Leow 7-Jun-15 2:51am    
In that case, use the first and second dashes as the borders, try the newly added solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900