The format of the text in which I need to extract numbers is as follows:
23411268 - 23411270
Need to extract the following:
23411268
23411269
23411270
These numbers have to be listed in three seperate rows.
The format of the text in which I need to extract numbers is as follows:
23411268 - 23411270
Need to extract the following:
23411268
23411269
23411270
These numbers have to be listed in three seperate rows.
With worksheet functions...
A1 = your text string: 23411268 - 23411270
B1 =LEFT(A1,FIND(" ",A1)-1)+0
C1 =MID(A1,FIND("-",A1)+2,LEN(A1))+0
A3 =IF(MAX($A$2:A2)=$C$1,"",MAX($A$2:A2,$B$1-1)+1)
...copy cell A3 down until the values stop appearing.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
It's a lot uglier to look at, but you could skip the B1 and C1 cells above by putting this formula in A3 and copying down:
=IF(MAX($A$2:A2)=MID($A$1, FIND("-", $A$1)+2, LEN($A$1))+0, "", MAX($A$2:A2, LEFT($A$1, FIND(" ", $A$1)-1)-1)+1)
Thanks for the formula. However do I need to change the formula if the text string seperator is different?
ex: 2341145 / 2341146
or 2341145 .. 2341147
or 2341145..2341147
JB I noticed that your formula restricts itself to one cell location on the spreadsheet.
What do you do when your string is in other areas of the spreadsheet, and you don't want to have to edit the formula constantly due to the new location of the text string?
Gregg, the formula targets one cell and delivers the result. If other cells also need to be examined and processed the same way, then you will need to copy and edit the formula.
Are you saying that the cell that will be examined is constantly changing position in the worksheet? If so, why? Or do you have several cells that you want to process? Could you provide some more context?
Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!
If that's true, then realize we aren't kidding when we say to read through the Forum Rules so you can use and follow them effectively. Do that and all this correcting will go away.
The number of text strings to process is randomly positioned in different areas of the spreadsheet. Having to constantly edit the formula for each newly positioned text string slows me down considerably. I'm looking for a point and copy solution that negates the use of editing the formula due to a different cell address for the text string.
You should start over here, then. You asked a too simple question. Also, you should consider some control on your end as well...saying you might have text strings separated by a variety of characters is unnecessarily complex, don't you think?
To be able to "point" at anything and get a string of numbers would most likely:
1) be a VBA solution
2) require you to decide in advance all the different ways your two numbers will be separated and note them all so the macro can be trained
3) decide in advance where these outputs are supposed to go each time you activate the macro
Layout a full set of criteria and we'll try again. But think it all through, we're not on a design team here, we want to help but not drag this out forever, so a good complete set of criteria, method, end results...speed this whole thing along.
Perhaps you can upload a sheet demonstrating ALL the variations you have to deal with, all the various places they might be, etc, and we can suggest something specific.
Click GO ADVANCED and use the paperclip icon to post up your workbook.
See attached samples
I have also posted this question on another forum, the url address is below:
http://www.mrexcel.com/forum/showthread.php?t=450602
Last edited by gregddd1; 02-25-2010 at 10:45 PM.
Gregddd1, you still have not reacted to the cross post warning. Read the link in my signature and then act.
Do not expect any answers on this thread until you have done so.
I have edited the previous post to include a cross-posted address.
I'm looking at post #11...3 questions and the sample workbook only sort of answers #2.
The values can be anywhere in A:E? OK, so are they alone in these random cells or in the midst of longer strings? Should the macro willy-nilly check every cell in A:E or do you have a better thought about the selection method you haven't shared yet? Are there other values in A:E we have to carefully avoid changing? Any chance at all you can control the date input so the strings are consistent in one method instead of 6?
And #3?
The text strings like the ones in the examples are the only text strings that needs to be converted, all other text strings need not be converted and can be ignored. Also, we're only talking about a max of 250 lines of these text strings that need to be converted per sheet.
The result (numbers) of the conversion needs to go directly below the text string that is being converted. See below.
2113456 - 2113460
2113456
2113457
2113458
2113459
2113460
Yes, the text strings could be anywhere in those columns.
No, the 6 examples are the typical text strings I'm having to work with.
The outputs are always directly below (in seperate rows) the text strings.
Thanks so much for your help and patience with this problem of mine!
The strings found are always far enough away from the next strings to put in numbers without moving anything? Like, if 10 numbers need to be put in, there would be nothing in the 10 rows beneath the found string?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks