Extract Specific Text From Cell

emacleod

New Member
Joined
Jul 21, 2015
Messages
12
Office Version
  1. 365
Hello and thank you for your time to assist me -

I need a formula that can evaluate the text based values in a cell to specifically return any text string with numbers and their decimals which maybe contained within. Essentially, I need to extract application versions in an installation directory path. Installations adhere to the following conventions using decimals to denote the octates, like:

12.34.56.7890
1.2.3.4
001.223.445.9876
9.8.008.425

Cell Value titled Installation Path would contain a text string like:
\endor4381\bkup\generic12.34.56.7890rpr\application\remote\4l16ogpackage\9114topdraw46\concise

In the above example, the formula would only return the '12.34.56.7890' since this is meets the criteria of an expected application version. Other numbers present in the install path would be ignored since they do not meet.

My data is in an Excel Table. I am currently running Excel 365 MS Build 2208

Let me know if there is any additional information you may need?

Once again, THANK YOU!

emacleod
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Just one example is not enough, please provide 5-6 rows with different possible text lines.
 
Upvote 0
My apologies for not supplying the appropriate amount of examples. Below is a screenshot of a few. I'm unable to upload a Mini-sheet.

1686938871257.png


Here is the paste values data, too:

Installation Path Extracted Version
G:\endor4381\bkup\generic12.34.56.7890rpr\application\remote\4l16ogpackage\9114topdraw46\concise 12.34.56.7890
U:\cornerthough\callctr\1.2.3.4 1.2.3.4
/raptor/businessforms34-bf/blue001.223.445.9876-autolog\stream 001.223.445.9876
//slice//cmr9.8.008.425/dir 9.8.008.425
/aeu/businessinteligence/forecast-lite/7.6.9a1 7.6.9
/cramfin/totalbkp/app/view/archive/ver12.1.2.4.20130719/calc72-937thr% 12.1.2.4.20130719


--Thank You
 
Last edited:
Upvote 0
How would an Excel routine KNOW which set(s) of numbers in any given string would be the one you want?
There needs to be some criteria to determine this.
 
Upvote 0
Excel would not know. Ideally, there would be a lookup table which compare the possible results in the table. There are too many variables to account for in order for me to accomplish that. This is why I'm taking this approach, to determine if there is a application version candidate in the installation path, based on that ###.####.####.###### format. That numbering condition is the criteria. Again, a lot of variables to account for in order to carve-out examples like I had included above.
 
Upvote 0
I am agree with @kweaver
There should be some logic in each line to extract desired result.
 
Upvote 0
I understand - the number and decimal format is all I have to go on. I appreciate your time. You don't have to go any further with this inquiry. It can be closed.

Thank you
 
Upvote 0
Never one to give up...how about the following that uses some helper columns (final extraction is in E):

021623 Misc.xlsx
ABCDE
1
2G:\endor4381\bkup\generic12.34.56.7890rpr\application\remote\4l16ogpackage\9114topdraw46\concise34.56.7890G:\endor4381\bkup\generic121212.34.56.7890
3U:\cornerthough\callctr\1.2.3.42.3.4U:\cornerthough\callctr\111.2.3.4
4/raptor/businessforms34-bf/blue001.223.445.9876-autolog\stream223.445.9876-/raptor/businessforms34-bf/blue001001001.223.445.9876
5//slice//cmr9.8.008.425/dir8.008.425///slice//cmr999.8.008.425
6/aeu/businessinteligence/forecast-lite/7.6.9a16.9/aeu/businessinteligence/forecast-lite/777.6.9
7/cramfin/totalbkp/app/view/archive/ver12.1.2.4.20130719/calc72-937thr%1.2.4.20130719//cramfin/totalbkp/app/view/archive/ver121212.1.2.4.20130719
Sheet10
Cell Formulas
RangeFormula
B2:B7B2=LEFT(TEXTAFTER(A2,".")&"a",MIN(IFERROR(SEARCH(CHAR(SEQUENCE(26,,65,1)),TEXTAFTER(A2,".")&"a"),""))-1)
C2:C7C2=TEXTBEFORE(A2,".")
D2:D7D2=RIGHT(C2, LEN(C2) - MAX(IF(ISNUMBER(MID(C2, ROW(INDIRECT("1:"&LEN(C2))), 1) *1)=FALSE, ROW(INDIRECT("1:"&LEN(C2))), 0)))
E2:E7E2=D2&"."&SUBSTITUTE(SUBSTITUTE(B2,"-",""),"/","")
 
Upvote 0
Assuming you can utilize Helper columns, I came up with the following solution to this problem.
Note there needs to be at least 3 periods and the digits cannot exceed 3 digits - similar to an IP address.
- The formula in Cell B2 is =IF(IFERROR(VALUE(MID($A2,SEARCH(".",$A2)-3,3)),0)<>0,MID($A2,SEARCH(".",$A2)-3,3),IF(IFERROR(VALUE(MID($A2,SEARCH(".",$A2)-2,2)),0)<>0,MID($A2,SEARCH(".",$A2)-2,2),MID($A2,SEARCH(".",$A2)-1,1)))
- The formula in Cell C2 is =IF(IFERROR(SEARCH(".",(MID($A2,SEARCH(".",$A2)+1,3))),0)=0,MID($A2,SEARCH(".",$A2)+1,3),IF(IFERROR(SEARCH(".",(MID($A2,SEARCH(".",$A2)+1,2))),0)=0,MID($A2,SEARCH(".",$A2)+1,2),MID($A2,SEARCH(".",$A2)+1,1)))
- The formula in Cell D2 is =IF(IFERROR(SEARCH(".",(MID($A2,SEARCH(".",$A2)+2+LEN(C2),3))),0)=0,MID($A2,SEARCH(".",$A2)+2+LEN(C2),3),IF(IFERROR(SEARCH(".",(MID($A2,SEARCH(".",$A2)+2+LEN(C2),2))),0)=0,MID($A2,SEARCH(".",$A2)+2+LEN(C2),2),MID($A2,SEARCH(".",$A2)+LEN($B2)+1+LEN($C2),1)))
- The formula in Cell E2 is =IF(IFERROR(SEARCH(".",(MID($A2,SEARCH(".",$A2)+3+LEN(C2)+LEN(D2),3))),0)=0,MID($A2,SEARCH(".",$A2)+3+LEN(C2)+LEN(D2),3),IF(IFERROR(SEARCH(".",(MID($A2,SEARCH(".",$A2)+3+LEN(C2)+LEN(D2),2))),0)=0,MID($A2,SEARCH(".",$A2)+3+LEN(C2)+LEN(D2),2),MID($A2,SEARCH(".",$A2)+LEN($B2)+1+LEN($C2),1)))
- The formula in Cell F2 is =$B2&"."&$C2&"."&$D2&"."&$E2

All formulas should work as needed when copied!
1686951465145.png
 
Upvote 0
You could try a user-defined function like this. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below (you can use the icon at the top right of the code pane below) into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below and copy down.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

VBA Code:
Function GetVersion(s As String) As String
  With CreateObject("VBScript.RegExp")
    .Pattern = "(\d+\.)+\d+"
    If .Test(s) Then GetVersion = .Execute(s)(0)
  End With
End Function

emacleod.xlsm
AB
1DataVersion
2G:\endor4381\bkup\generic12.34.56.7890rpr\application\remote\4l16ogpackage\9114topdraw46\concise12.34.56.7890
3U:\cornerthough\callctr\1.2.3.41.2.3.4
4/raptor/businessforms34-bf/blue001.223.445.9876-autolog\stream001.223.445.9876
5//slice//cmr9.8.008.425/dir9.8.008.425
6/aeu/businessinteligence/forecast-lite/7.6.9a17.6.9
7 
8No version here 
9/cramfin/totalbkp/app/view/archive/ver12.1.2.4.20130719/calc72-937thr%12.1.2.4.20130719
Sheet1
Cell Formulas
RangeFormula
B2:B9B2=GetVersion(A2)
 
Upvote 0
Solution

Forum statistics

Threads
1,215,109
Messages
6,123,136
Members
449,098
Latest member
Doanvanhieu

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