NEED HELP for getting text from cell

rajtak

Board Regular
Joined
Feb 23, 2009
Messages
74
Hi,

I need your help to get some text right before some common text in the cell.
E.g.

if
Cell A1 contains ABCD 36 IN
Cell A2 contains ABCDEFGH 48 IN XX
Cell A3 contains ABCD XX XXX 22 IN HHH

I need that value before the IN i.e.

Cell B1 it should be 36
Cell B2 it should be 48
Cell B3 it should be 22

Please suggest any formula to get this...
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Raj
If you only want to extract numbers froma text string try this Function
Code:
Function ExtractNumber(rCell As Range)
Dim lCount As Long, l As Long
Dim sText As String
Dim lNum As String

sText = rCell
For lCount = Len(sText) To 1 Step -1
    If IsNumeric(Mid(sText, lCount, 1)) Then
        l = l + 1
        lNum = Mid(sText, lCount, 1) & lNum
    End If
If l = 1 Then lNum = CInt(Mid(lNum, 1, 1))
Next lCount

ExtractNumber = CLng(lNum)
End Function

so, to extract numbers from a string in sya, cell A1....type extractnumber(A1) in B1

Regards
Michael M
 
Upvote 0
Try this
Excel Workbook
AB
1ABCD 36 IN36
2ABCDEFGH 48 IN XX48
3ABCD XX XXX 22 IN HHH22
Sheet1
Excel 2003
Cell Formulas
RangeFormula
B1=-LOOKUP(0,-RIGHT(LEFT(A1,SEARCH("in",A1)-2),ROW(OFFSET($A$1,,,LEN(A1)))))
 
Upvote 0
Actually there are numbers also in the cells

E.g.

Cell A1 ABCDE 45 XXX 68 IN
Cell A2 ABCDE XXX 58 SS 52 IN XXX
Cell A3 ABCDE 45 55 IN XX

value that i need are the inches that are given before 'IN'

Cell B1 68
Cell B2 52
Cell B3 55
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,370
Members
449,080
Latest member
Armadillos

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