ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Grabbing text from just part of a cell (https://www.excelbanter.com/excel-programming/349611-grabbing-text-just-part-cell.html)

Mary T[_2_]

Grabbing text from just part of a cell
 

Hi all,

I have sheets that come in that include a cell that says, for instance
'Subject no.: 5'. How would I grab just the '5' part of that cell?

Help appreciated, thanks

--
Mary
-----------------------------------------------------------------------
Mary T's Profile: http://www.excelforum.com/member.php...fo&userid=3015
View this thread: http://www.excelforum.com/showthread.php?threadid=49834


Kevin B[_5_]

Grabbing text from just part of a cell
 
The following function will grab whatever follows the colon space:

Function SubjectNum(InitialValue As String) As String

Dim l As Long

'Find the location of the colon and add 1 for the space
l = InStr(1, InitialValue, ":") + 1

SubjectNum = Right$(InitialValue, Len(InitialValue) - l)

End Function

--
Kevin Backmann


"Mary T" wrote:


Hi all,

I have sheets that come in that include a cell that says, for instance,
'Subject no.: 5'. How would I grab just the '5' part of that cell?

Help appreciated, thanks!


--
Mary T
------------------------------------------------------------------------
Mary T's Profile: http://www.excelforum.com/member.php...o&userid=30151
View this thread: http://www.excelforum.com/showthread...hreadid=498349



Mary T[_3_]

Grabbing text from just part of a cell
 

That worked great, thanks!


--
Mary T
------------------------------------------------------------------------
Mary T's Profile: http://www.excelforum.com/member.php...o&userid=30151
View this thread: http://www.excelforum.com/showthread...hreadid=498349



All times are GMT +1. The time now is 03:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com