Segregation specific numbers from given text or sentense

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hi Team,

I hope anyone can help me on the formula or vba function to segregate the specific logic numbers from the given text ..here I mentioned input data and output and based on logic

Input Data

<tbody>
</tbody>
Output should be

<tbody>
</tbody>
Count of Digits

<tbody>
</tbody>
Logic Description

<tbody>
</tbody>
PO 9124818 /34 managed

<tbody>
</tbody>
9124818

<tbody>
</tbody>
7

<tbody>
</tbody>
Start from 9 and it will be there 7 digits

<tbody>
</tbody>
RO 31248184 11/9 taken from goods

<tbody>
</tbody>
31248184

<tbody>
</tbody>
8
Start from 3 and it will be there 8 digits

<tbody>
</tbody>
lOK 189897 should be fine at 9/123

<tbody>
</tbody>
189897

<tbody>
</tbody>
6
Start from 1 and it will be there 6 digits

<tbody>
</tbody>

<tbody>
</tbody>

Please let me know if this doable or not ...Thank you..
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
What is the 'logic'?

Is it simply the set of contiguous digits in the cell?
 
Upvote 0
Thank for your response...I should have explained little more details ....the position of numbers vary from each cell and need one formula to get the output based on three criteria...
for example in A1 should contain "PO /34 managed 9124818 " then the given formula will not help ...so, need one formula to get the output ....
 
Upvote 0
Hi Norie, The logic what I am trying explain here....the position of given set numbers vary from cell to cell ...sometime it may start at beginning and sometime it may start at end...any position it may start...logic is

if cell contains "PO 9124818 /34 managed" then output should be 9124818 ...if the number start from 9 then need to extract complete 7 digits including 9
if cell contains "RO 31248184 11/9 taken from goods" then output should be 31248184 ..if the number start from 3 then need to extract complete 8 digits including 3 ...
if cell contains "lOK 189897 should be fine at 9/123" then output should be 189897 ..if the number start from 1 then need to extract complete 6 digits including 1

one important thing is the position of number vary from cell to cell ...I do not know ..it could be anywhere in the given text but need the output what I mentioned above...

it would really help if you could provide the solution to this...thank you
 
Upvote 0
Thank for your response...I should have explained little more details ....the position of numbers vary from each cell and need one formula to get the output based on three criteria...
for example in A1 should contain "PO /34 managed 9124818 " then the given formula will not help ...so, need one formula to get the output ....

You might want to answer Norie's question in Message #2 so that we know why you want 9124818 and not 34.
 
Upvote 0
This formula will find the longest number in the cell:

AB
1Input DataNumber
2PO 9124818 /34 managed9124818
3RO 31248184 11/9 taken from goods31248184
4lOK 189897 should be fine at 9/123189897
5PO /34 managed 91248189124818

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet6

Array Formulas
CellFormula
B2{=MAX(IFERROR(MID(SUBSTITUTE(A2," ","A"),ROW(INDIRECT("1:"&LEN(A2))),TRANSPOSE(ROW(INDIRECT("1:"&LEN(A2)))))+0,0))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



There are still lots of cases where it might fail. Numbers over 15 digits will lose some due to Excel's 15-precision. If you have multiple numbers, it may pick the wrong one. Anytime you have inconsistent formatting, it's problematic trying to pick out the particular data you want.
 
Upvote 0
Not really, need number what I mentioned in the cell

But why that number and not the other number in the cell.


A Generalized "Please Note"
--------------------------------------
One thing you must keep in mind when you ask a question in a forum... the people you are asking to help you know absolutely nothing about your data, absolutely nothing about how it is laid out in the workbook, absolutely nothing about what you want done with it and absolutely nothing about how whatever it is you want done is to be presented back to you as a result... you must be very specific about describing each of these areas, in detail, and you should not assume that we will be able to "figure it out" on our own. Remember, you are asking us for help... so help us to be able to help you by providing the information we need to do so, even if that information seems "obvious" to you (remember, it is only obvious to you because of your familiarity with your data, its layout and the overall objective for it).
 
Upvote 0
Hi Eric, Many thanks for your response...looks it works many times...but still if anything followed further number for example "18988713/14/2007" if I want to try to get the 189887 but it will gives me 18988713

Is there any way to get rid of this as if its start from 1 it should only give 6 digits including starting number 1
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top