Free Microsoft Excel 2013 Quick Reference

Extract text within two specific values within a cell

I have a cell (D2) of wrapped text that contains two keywords: "NAME:" and
"CONSTRAINED". I want to extract all of the text between these two keywords
and paste it in cell L2.
I'm getting closer by using


to get the text that follows the first keyword "NAME:", but I am stuck now
trying to determine how to get the extraction to stop when the query reaches
the second keyword "CONSTRAINED".

Your help would be much appreciated

Post your answer or comment

comments powered by Disqus

I have a cell that contain the value : c:testworking filesabc123.xls

How do you write the function to extract the string of text after the 2nd backslash and before the 3rd backslash (i.e. "working files"). Also could you please explain me every part of that function.

Thank you very much.

I have a column that is memo text, and I wanted to bold or format to a color a word or phrase within that memo field column i.e. on entire Column A, I wanted to bold and change to red the word "Excel" each time it is listed in Column A, but leave everything else unformatted within the cell.

How would I format text within a cell automatically? I toyed around with the search/find and conditional format, but could not find an answer.

Please advise when you gurus get a chance. Thanks!

I am sure this is simple, but what command would I use, within an forumla to grab thge first two letters in a cell and use those to continue?


im desperately in need of help.

how do i extract the last 2 words in a cell?

ex. 8137 Plaza Amber, Ortigas Center, Pasig City

how do get just pasig city?

please help me


I was trying to remove the last two words from a cell in excel.

I only have the formula to remove one word:
=IF(ISNUMBER(FIND(" ",H104)),LEFT(H104,LOOKUP(32768,FIND(" ",H104,ROW(INDIRECT("1:"&LEN(H104)))))),H104)

and I was wondering if I can remove two at the same time?

how do you delete a number within larger number in a cell for several rows?
for example i want to delete the 0 in the 7th position of 025000000.

In Excel, is there a limit on the amount of text that can go into a cell? I
have to create either a spreadsheet or a database (table definitely doesn't
work for my purposes) in which one of the fields will have to be large enough
to take a significant amount of text - anywhere from one sentence to the
equivalent of half a page.

I need a formula that will extract the first 7 characters from a cell. I've attached a small excel file with sample data.
Cell A2 contains the following.


I want cell B2 to read G21-863

I need to display all text after first comma in a cell in another cell. For example

Text in A1 = 1.1, 1.2, 1.3

I need to display in B1 all the text after the first comma which would be = 1.2, 1.3

Can anyone help?

Hi guys

May I know if there is any formula to extract the text within a cell?

For example, in Cell A1, it has the text value ~ "ABC124, 345655".

I would like to get the result in B1 ~ "ABC124", meaning all the values before the ",". The data is result of a formula so I am trying not to use text to column.

Thank you!

Is it possible to extract data in a text string between 2 specific values? For example, I have a text string similar to this one:

CCITC08100301PER0018 1 081003 AB THME1 PC01 Plstc 1 0.3800
I want to extract the the first number that is between the first 2 spaces of the text string which in this case would be the number 1. It might help to know that all the rows of text strings start off with 20 characters before the 1st space occurs.
I am very new at VBA so I would appreciate any suggestions using a method in Excel.

Thank you!!

Im having trouble extracting a number from within a cell. I have a cell which contains an IP address (ie. and I want to extract the last digits after the third period (ie. 54) Any suggestions?

I'm trying to extract the value (both text strings and numbers) from a cell and put it into another cell without creating a reference.

The cell I am extracting from I will want to change, but I want the value in the new cell to stay the same when I change the first...

The reason for this is to record a Macro to populate a row with values from a column. It works fine, but when i run the macro (with relative references) the values taken from the first row also change....

any ideas? basically just need to take the contents of the cell...

Thanks in advance

First, a continued big thank you for all the help you guys have given me with strange requests and VBA hurdles :-)

This time, I'm looking for a way to search an array for parts of a string (not one but two) present in a cell value ('Value cell'), and then place the 'Value cell' value in the appropriate next free cell in the correct column within a table...

Yeah, I know.

I've attached an example worksheet. There's only a finite number of allowed strings that can be values entered into the 'Value cell', and they come in three flavours, each of which is a column title in the table. I need some way of searching the contents of Value cell for the relevant strong 'Start, Middle' or 'End' and each of the listed 'product' strings and then placing the contents of the Value cell in the next free cell in the correct column, comma delimited with the time it was entered.

I've not found anything that comes near to describing this after searching about for it. Any help would be very gratefully received :-) Thank you again

Hello All,

Hopefully someone can point me in the right direction. I am trying to extract the url from text that is hyperlinked in a cell. For example, the cell (A1) contains the text "email" that is hyperlinked to and I need to write/extract the url ( in this case) to a separate cell (B1) in text format.

Thank you in advance for your help/suggestions, very much appreciated.



I need to search for a cell value in another sheet and copy the parent value of the cell which it reports into. Below are the steps I am following but not able to put in in macro as I am new to writting macro and getting stuck at some stages.

Request you to go through the following steps and kindly help me resolving the same.

I am attaching two excel sheet which I have mentioned in my Steps and the same steps are mentioned in the excel sheet called "Copy of Extract"

Step 1 Select value of cell B2 in worksheet "Split Data" which is in workbook "Copy of Extract"

Step 2 Check if value of cell B2 is present in column A of 1st worksheet "Bat" which is in workbook "Copy of Mapping Details"

Step 3 If value of cell B2 is present in column A of 1st worksheet "Bat" then start searching for the first 1 (number 1) in column C in upward direction
NOTE: (For E.g. If B2 i.e. NNN is present on row no. 15, start searching column c from row 15(from Cell C15 to upward direction) to upward direction and give me the value of cell A where first 1 is present "In this case it will be at row 4 and value returned will be CCC)

Step 4 Copy the value of cell A where first "1" is present
NOTE:In this case: Copy the value "CCC"

Step 5 Copy the value of cell A in cell B2 of worksheet "Data"
NOTE:This cell is marked in RED

Step 6 if value of cell B2 is not present in column A of 1st worksheet "Bat" then check
if value of cell B2 is present in column A of 2nd worksheet "Ball"

Step 7 If value of cell B2 is present in column A of 2nd worksheet "Ball" then start searching for the first 1 (number 1) in column C in upward direction (and if Value of B2 does not exist in sheet "Ball" search it in 3rd sheet "Stump" and if not present then search it in 4th sheet "Pad")
NOTE;If Value is not present in column A of 1st sheet, Check in column A of 2nd sheet, if still not present then, Check in column A of 3rd sheet and so on till the last sheet is present and till value is not found. If value is not found in any of the sheets give "NA" in the cell in sheet "Data" as an output for the cell.

Step 8 Follow Step 4

Step 9 Follow Step 5

Step 10 Now go to cell C2 of worksheet "Split Data"
NOTE: We will check the cells horizontally one by one till the "Sr Nos" are present in column A of workbook "Copy of Extract" and once the Sr No ends macro will stop/end

Step 11 Check if cell C2 has any value

Step 12 If value is present follow Step1, 2, 3, 4, 5 to copy the value of cell A in cell C2 of sheet "Data" from sheet 1, 2, 3 or 4 which are in workbook "Copy of Mapping Details"

Step 13 If cell C2 is empty jump to cell B3

Step 14 Follow Step 1,2,3,4,5 for value of cell B3 and copy the value of cell A in cell B3 of sheet "Data" as mentioned above in step 5

Step 15 Then go to C3, follow steps 1,2,3,4,5 and then for D3 and so on till the cell
beside last cell is empty

Step 16 Continue this search of cells of sheet "Split Data" till last row. In this case it will be row 11,Cell G11
NOTE: Please see that rows and columns will not be limited upto 11 rows or 10 columns. There can be 1000's of rows and colmns for which we need to follow the search and copy process. The row nos. and column nos. can change based on the data available. So, I need a macro which can be used for any no. of row and columns

I humbly hope to receive a great solution as soon as possible.


I would like to assign a text value to a cell that has two different fonts, or different font sizes of the same font, whatever. I know that you can do this manually by clicking on the cell and highlighting the text you want changed. Is there a way to do this through VBA?? Essentially, I want to have a text value in a cell and under certain circumstances have a smaller value right next to it in parentheses. It isn't practical to have two columns for this.

I want to extract a cell reference from a formula in a cell

I tried the right function referenceing the cell but it returns the right
portion of the function result

how do I specify it to extract the physical formula text in the cell and not
the formula value in the cell?

example... a cell b5 contains the formula "='Execute Dealer Plan'!$P647"
which has a value of "select status"
if cell b6 contains formula "=right(b5,4) I'm wanting "P647" returned and
not "atus"



I was wondering how to remove the last two characters in a cell containing text?



Hi there

I have several cells in a sheet from which I would would like to extract text from the middle of the string and concat the word actual on the end. e.g

b3 contains:


In the cell below that string, I would like to extract the word "preliminaries" and add the word "actual" to the end of it (result = "Preliminaries actual" (in sentence case is possible))

b5 contains:


In the cell below I would like to extract the words "Structural steel" and add the word "actual" to the end of it (result = "Structural steel actual" (in sentence case is possible))

Some of the strings have two words I would like to extract and some only have a single word - if somenone could assist with a formula that would work in both cases it would be great.

Thanks in advance

I am looking to identify text within a cell and pull the data from the adjacent text (which happens to reside within parentheses) in the same cell

I have 5,000 rows, so manually managing this is problematic.

Here is an example of the text that may be in a cell (we can call the cell "A1"):

LAN Switching (40);Routing (30);Security (30)

I would like, for example, be able to identify if the cell contains the word "Routing" and if so, pull the number 30 from between the parenthesis just to the right of that found word. The number between the parentheses could range from 0 to 100, so I can't leveraged any fixed character count logic.

I am hoping that the results in the cell would simply be: 30.

Any examples would be incredibly helpful and appreciated.

I would like to extract everything to the right of the numbers in a cell that contains both text and numbers (format: text space numbers space text), text to columns doesn't work.

Example: Medical Unit 123456 Registered Nurse
Clinical Unit (3N) 234567 RN

I need to extract "Registered Nurse" and "RN"

Many thanks in advance.

Hey there.

There seems to be a limit to the number of characters which can be "sent" from a text box to a cell using the below code. Currently, I have a text box where information is entered. There is a button with the below macro assigned which is meant to make the text from the text box appear in a nearby cell.

It seems that it will not "send" more than 256 characters.

My goal is to allow text to be entered by a user in a space large enough for them to see all the text at once (ie. in a large text box). This text is then made to appear in a cell on another part of the worksheet and is used to generate a finished report. I am hesitant to allow the user to use type in the actual cell due to the protection currently in place on this workbook.

Any suggestions on how to work around this? Thanks for any assistance.

    Range("C75").Value = ActiveSheet.TextBoxes("Text Box 23").Text 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines

Good morning board. I know I have seen this thread somewhere but as it happens often, I cannot find it.

What I want to do is to move an entire row in Openworkorder, to Workorderhist after I enter specific value in a cell in Openworkorder. The record should be placed in the next available empty row in Workorderhist upon closing the workbook.

As usual, thanks for your help.

No luck finding an answer? You could always try Google.