![]() |
How to select the numbers?
Does anyone have any suggestions on how to select the numbers within a string?
For example, in cell A1, there is a string 6023 - 10056. I would like to retrieve any number before "-" in cell B1, it should return 6023, and I would like to retrieve any number after "-" in cell C1, it should return 10056. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
How to select the numbers?
If your numbers are in Col A and all have the same pattern (two numbers
separated by " - ") then use this in B1 =MID(A1,1,FIND(" - ",A1)-1) to get 6023 and this in C1 to get 10056. You can copy down the formula. =MID(A1,FIND(" - ",A1)+3,LEN(A1)) "Eric" wrote: Does anyone have any suggestions on how to select the numbers within a string? For example, in cell A1, there is a string 6023 - 10056. I would like to retrieve any number before "-" in cell B1, it should return 6023, and I would like to retrieve any number after "-" in cell C1, it should return 10056. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
How to select the numbers?
HI,
If you want the number returned as text: =TRIM(LEFT(A1,FIND("-",A1)-1)) =TRIM(MID(A1,FIND("-",A1)+1,10)) If you want it returned as a number: =--TRIM(LEFT(A1,FIND("-",A1)-1)) =--TRIM(MID(A1,FIND("-",A1)+1,10)) In all cases the text was in A1 -- If this helps, please click the Yes button Cheers, Shane Devenshire "Eric" wrote: Does anyone have any suggestions on how to select the numbers within a string? For example, in cell A1, there is a string 6023 - 10056. I would like to retrieve any number before "-" in cell B1, it should return 6023, and I would like to retrieve any number after "-" in cell C1, it should return 10056. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
All times are GMT +1. The time now is 03:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com