bobby_smith
Board Regular
- Joined
- Apr 16, 2014
- Messages
- 90
I earlier requested assistance in creating two user define functions to separate my data as shown in the table below.
If you have an alternative or a more efficient function that would accomplish the same task, that will be ok.
Excel 2010
<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]5678[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]76[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]254[/TD]
</tbody>(for those wondering why not use the text formulas such as LEFT, MID, RIGHT or the text to column feature, I've put the explanation at the end of the post)
Someone was kind enough to reply with formula that works perfectly. However, I'm attempting to write the formula as a user defined function and I keep getting errors. I think its because of the find function.
Here are the two formulas I would like to be written as a function
B3=LEFT(MID(A3,FIND(" ",A3,1)+1,99),FIND(" ",MID(A3,FIND(" ",A3,1)+1,99),1)-1)
C3=MID(A3,FIND(B3,A3,1)+LEN(B3)+1,99)[TABLE="width: 85%"]
<tbody>[TR]
[TD]A3 will represent the cell that has the data I need.
Here is my original post:
I would like some assistance creating two separate “user defined functions” whereby when I select the data, it separates the data to either number or text.
I’ve included the format that the data will normally be in.
Also please note that i'm requesting a function and not a macro so that for example I can type in cell
B2: =function1(A2) and get the results that are shown in cell B2
Excel 2010
<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]5678[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]76[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]254[/TD]
</tbody>
It will always be two letters,followed by numbers that can range from 1 digit to four digits, and then text that can be any length.
I currently use the text features such as LEFT(), MID(), RIGHT(), but my results are inconsistent because both the numbers and text may vary in length.
I’ve also tried the “Text to Column” feature, however the result is inconsistent because the text at the end varies in length. For example, if I have 200 lines of items of different length, the text to column feature would sometimes put data in adjacent cells overwriting information already in those cells
What I need the function to do is, upon selecting the data
1) Only the numbers remain
2) Only the text after the numbers remain.
Hence Why I would prefer two separate macros.
I would really appreciate your help with this.[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 85%"]
<tbody>[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
If you have an alternative or a more efficient function that would accomplish the same task, that will be ok.
Excel 2010
A | B | C | |
---|---|---|---|
Original Data | Function 1 | Function 2 | |
TD 5678 TEXT TEXT | TEXT TEXT | ||
TI 76 TEXT TEXT TEXT TEXT | TEXT TEXT TEXT TEXT | ||
NT 254 TEXT TEXT TEXT | TEXT TEXT TEXT |
<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]5678[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]76[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]254[/TD]
</tbody>
Someone was kind enough to reply with formula that works perfectly. However, I'm attempting to write the formula as a user defined function and I keep getting errors. I think its because of the find function.
Here are the two formulas I would like to be written as a function
B3=LEFT(MID(A3,FIND(" ",A3,1)+1,99),FIND(" ",MID(A3,FIND(" ",A3,1)+1,99),1)-1)
C3=MID(A3,FIND(B3,A3,1)+LEN(B3)+1,99)[TABLE="width: 85%"]
<tbody>[TR]
[TD]A3 will represent the cell that has the data I need.
Here is my original post:
I would like some assistance creating two separate “user defined functions” whereby when I select the data, it separates the data to either number or text.
I’ve included the format that the data will normally be in.
Also please note that i'm requesting a function and not a macro so that for example I can type in cell
B2: =function1(A2) and get the results that are shown in cell B2
Excel 2010
A | B | C | |
---|---|---|---|
Original Data | Macro 1 | Macro 2 | |
TD 5678 TEXT TEXT | TEXT TEXT | ||
TI 76 TEXT TEXT TEXT TEXT | TEXT TEXT TEXT TEXT | ||
NT 254 TEXT TEXT TEXT | TEXT TEXT TEXT |
<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]5678[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]76[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]254[/TD]
</tbody>
It will always be two letters,followed by numbers that can range from 1 digit to four digits, and then text that can be any length.
I currently use the text features such as LEFT(), MID(), RIGHT(), but my results are inconsistent because both the numbers and text may vary in length.
I’ve also tried the “Text to Column” feature, however the result is inconsistent because the text at the end varies in length. For example, if I have 200 lines of items of different length, the text to column feature would sometimes put data in adjacent cells overwriting information already in those cells
What I need the function to do is, upon selecting the data
1) Only the numbers remain
2) Only the text after the numbers remain.
Hence Why I would prefer two separate macros.
I would really appreciate your help with this.[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 85%"]
<tbody>[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]