If you are looking for ways to extract specific numbers from a cell in Excel, then this article will be helpful for you. So, let’s dive into the main article to learn more about the procedures of extracting specific numbers from a cell.

Here, we have the following dataset containing the product codes and sales records of some items. The product codes are created here with the combination of the item’s id numbers, their name, and respective years. By applying the following 11 methods we will try to extract the specific numbers from these codes such as the *ID Numbers*, *Years, *etc.

We have used *Microsoft Excel 365* version here, you can use any other versions according to your convenience.

**Table of Contents**Expand

## 1. Using Flash Fill Feature to Extract Specific Numbers from an Excel Cell

Here, we are going to use the easiest and simplest way to extract the *Id Numbers *from the *Product Codes *with the help of the **Flash Fill **feature.

** Steps**:

➤ First, put down part of the

*ID Numbers*from the code in the first two cells,

**C4**and

**C5**.

➤ Select the third cell, **C6**, and then go to the **Data **Tab >> **Data Tools **Group >> **Flash Fill **Option.

After that, the **ID No. **column will be filled out with the specific numbers, *ID Numbers*, from the *Product Codes*.

## 2. Using Excel LEFT Function to Extract Specific Numbers

Here, we will use the **LEFT function** to extract the *Id Numbers *from the *Product Codes *and the **VALUE function** to convert the extracted strings into numeric values.

** Steps**:

➤ Type the following function in cell

**C4**.

`=VALUE(LEFT(B4,4))`

Here, **B4 **is the Product Code, and **4 **is for extracting the first four characters from the left. As **LEFT **will extract the specific numbers as text strings, VALUE will convert the extracted strings into numeric values.

➤ Press **ENTER** and drag down the **Fill Handle **tool.

Finally, you will get the *ID Numbers *of the products in the ID No. column.

## 3. Inserting Excel RIGHT Function to Extract Specific Numbers

In this section, we will use the **RIGHT function** to bring out the specific numbers from the right portion of the Product Codes or the ** Years **and then accumulate them in the Year column.

** Steps**:

➤ Type the following function in cell

**C4**.

`=VALUE(RIGHT(B4,4))`

Here, B4 is the *Product Code*, and 4 is for extracting the last four characters from the right. As RIGHT will bring out the specific numbers as text strings, VALUE will convert those strings into numeric values.

➤ Press **ENTER** and drag down the **Fill Handle **tool.

Finally, you will get the years from the Product Codes in the Year column.

## 4. Using Excel MID Function to Extract Specific Numbers from a Cell

Here, we will use the **MID function** to extract the *ID Numbers*, the first four numbers of the Product Codes, in the ID No column.

** Steps**:

➤ Type the following function in cell

**C4**.

`=VALUE(MID(B4,1,4))`

Here, **B4 **is the ** Product Code**,

**1**is the starting number, and

**4**is for extracting the first four characters from the start position. As

**MID**will extract the specific numbers as text strings,

**VALUE**will convert the extracted strings into numeric values.

➤ Press **ENTER** and drag down the **Fill Handle **tool.

In this way, we will be able to bring out the first four specific numbers, *ID Numbers*, in the **ID No. **column.

## 5. Obtaining Specific Numbers from Any Position with Excel FIND Function

For this section, we have rearranged the Product Codes randomly to extract the years from any position of these codes with the help of the **MID function** and **FIND function**.

** Steps**:

➤ Type the following function in cell

**C4**.

`=VALUE(MID(B4,FIND("2022",B4),4))`

Here, **B4 **is the ** Product Code**.

`FIND("2022",B4)`

`becomes`

`FIND("2022","apple18012022") →`

`finds the starting position of`

`2022`

`in`

`apple18012022`

`.`

`Output →`

`10`

`MID(B4,FIND("2022",B4),4)`

`becomes`

`MID(B4,10,4) →`

`extracts`

`4`

`characters with a starting position`

`10`

`Output →`

`2022`

`VALUE(MID(B4,FIND("2022",B4),4))`

`becomes`

`VALUE(2022) →`

`converts the string`

`2022`

`into a numeric value.`

`Output →`

`2022`

➤ Press **ENTER** and drag down the **Fill Handle **tool.

Eventually, we will have the years from the *Product Codes *in the **Year **column.

## 6. Extracting Specific Numbers from Any Position of a Cell Using SEARCH Function

Like the previous method here we will also search for the specific numbers ** 2022 **in the randomly created

**, but instead of the**

*Product Codes***FIND function**, we are going to use the

**SEARCH function**here.

** Steps**:

➤ Type the following function in cell

**C4**.

`=VALUE(MID(B4,SEARCH("2022",B4),4))`

Here, **B4 **is the ** Product Code**.

`SEARCH("2022",B4)`

`becomes`

`SEARCH("2022","apple18012022") →`

`finds the starting position of`

`2022`

`in`

`apple18012022`

`.`

`Output →`

`10`

`MID(B4,SEARCH("2022",B4),4)`

`becomes`

`MID(B4,10,4) →`

`extracts`

`4`

`characters with a starting position`

`10`

`Output →`

`2022`

`VALUE(MID(B4,SEARCH("2022",B4),4))`

`becomes`

`VALUE(2022) →`

`converts the string`

`2022`

`into a numeric value.`

`Output →`

`2022`

➤ Press **ENTER** and drag down the **Fill Handle **tool.

In this way, we will be able to bring out the years from the ** Product Codes** in the

**Year**column.

## 7. Extracting Specific Numbers from the End Position of Cells in Excel

Here, we will extract all of the numbers after the text values in the ** Product Codes **with the combination of the

**IFERROR**,

**VALUE**,

**RIGHT**,

**LEN**,

**MAX**,

**IF**,

**ISNUMBER**,

**MID**,

**ROW**,

**INDIRECT**

**functions**.

** Steps**:

➤ Type the following function in cell

**C4**.

`=IFERROR(VALUE(RIGHT(B4, LEN(B4) - MAX(IF(ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1)=FALSE, ROW(INDIRECT("1:"&LEN(B4))), 0)))), "")`

Here, **B4 **is the ** Product Code**.

`LEN(B4) →`

`gives the length of the total characters in the product code of cell`

`B4`

`.`

`Output →`

`13`

`INDIRECT("1:"&LEN(B4))`

`becomes`

`INDIRECT("1:"&13)`

`INDIRECT("1:13") →`

`gives the reference to this range`

`Output →`

`$1:$13`

`ROW(INDIRECT("1:"&LEN(B4)))`

`becomes`

`ROW(INDIRECT($1:$13) →`

`returns the row numbers serially in this range`

`Output →`

`{1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13}`

`MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)`

`becomes`

`MID("1801apple2022", {1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13}, 1) →`

`returns an array of extracted texts for the array of different starting positions.`

`Output →`

`{“1”; “8”; “0”; “1”; “a”; “p”; “p”; “l”; “e”; “2”; “0”; “2”; “2”}`

`MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1`

`becomes`

`MID({“1”; “8”; “0”; “1”; “a”; “p”; “p”; “l”; “e”; “2”; “0”; “2”; “2”})*1 →`

`returns numeric values for the number strings and`

`#VALUE`

`error for the text strings after multiplication with`

`1`

`Output →`

`{1; 8; 0; 1; #VALUE; #VALUE; #VALUE; #VALUE; #VALUE; 2; 0; 2; 2}`

`ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1)`

`becomes`

`ISNUMBER({1; 8; 0; 1; #VALUE; #VALUE; #VALUE; #VALUE; #VALUE; 2; 0; 2; 2}) →`

`returns`

`TRUE`

`for the numeric values otherwise`

`FALSE`

`.`

`Output →`

`{TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; TRUE; TRUE; TRUE}`

`ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1)=FALSE`

`becomes`

`{TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; TRUE; TRUE; TRUE}=FALSE →`

`returns`

`TRUE`

`for`

`FALSE`

`and`

`FALSE`

`for`

`TRUE`

`.`

`Output →`

`{FALSE; FALSE; FALSE; FALSE; TRUE; TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE; FALSE}`

`IF(ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1)=FALSE, ROW(INDIRECT("1:"&LEN(B4))), 0)`

`becomes`

`IF({FALSE; FALSE; FALSE; FALSE; TRUE; TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE; FALSE}, {1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13}, 0) →`

`returns the numbers from the array for`

`TRUE`

`otherwise`

`FALSE`

`.`

`Output →`

`{0; 0; 0; 0; 5; 6; 7; 8; 9; 0; 0; 0; 0}`

`MAX(IF(ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1)=FALSE, ROW(INDIRECT("1:"&LEN(B4))), 0))`

`becomes`

`MAX({0; 0; 0; 0; 5; 6; 7; 8; 9; 0; 0; 0; 0}) →`

`returns the maximum number from this range.`

`Output → 9`

`RIGHT(B4, LEN(B4) - MAX(IF(ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1)=FALSE, ROW(INDIRECT("1:"&LEN(B4))), 0)))`

`becomes`

`RIGHT("1801apple2022", 13 - 9)`

`RIGHT("1801apple2022", 4) →`

`returns the`

`4`

`characters from right.`

`Output →`

`2022`

`VALUE(RIGHT(B4, LEN(B4) - MAX(IF(ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1)=FALSE, ROW(INDIRECT("1:"&LEN(B4))), 0))))`

`becomes`

`VALUE(2022) →`

`converts the string into a numeric value`

`Output →`

`2022`

`IFERROR(VALUE(RIGHT(B4, LEN(B4) - MAX(IF(ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1)=FALSE, ROW(INDIRECT("1:"&LEN(B4))), 0)))), "")`

`becomes`

`IFERROR(2022, "") →`

`returns a blank for any error`

`Output →`

`2022`

➤ Press **ENTER** and drag down the **Fill Handle **tool.

Finally, you will get the specific numbers from the end of the cell and you can extract any number of values by using this formula.

*For using other versions except for Microsoft Excel 365, press CTRL+SHIFT+ENTER *instead of pressing

**.**

*ENTER*## 8. Extracting Specific Numbers from Starting Position of Cells

Here, we will extract all of the numbers before the text values in the ** Product Codes **with the combination of the

**IFERROR**,

**VALUE**,

**LEFT**,

**LEN**,

**MATCH**,

**IF**,

**ISNUMBER**,

**MID**,

**ROW**,

**INDIRECT**

**functions**.

** Steps**:

➤ Type the following function in cell

**C4**.

`=IFERROR(VALUE(LEFT(B4, MATCH(FALSE, ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4)+1)), 1) *1), 0) -1))," ")`

Here, **B4 **is the ** Product Code**.

`LEN(B4) →`

`gives the length of the total characters in the product code of cell`

`B4`

`.`

`Output →`

`13`

`INDIRECT("1:"&13+1)`

`INDIRECT("1:"&14) →`

`gives the reference to this range`

`Output →`

`$1:$14`

`ROW(INDIRECT("1:"&LEN(B4)+1))`

`becomes`

`ROW($1:$14) →`

`returns the row numbers serially in this range`

`Output →`

`{1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14}`

`MID(B4, ROW(INDIRECT("1:"&LEN(B4)+1)), 1)`

`becomes`

`MID("1801apple2022", {1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14}, 1) →`

`returns an array of extracted texts for the array of different starting positions.`

`Output →`

`{“1”; “8”; “0”; “1”; “a”; “p”; “p”; “l”; “e”; “2”; “0”; “2”; “2”; “ ”}`

`MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)*1`

`becomes`

`MID({“1”; “8”; “0”; “1”; “a”; “p”; “p”; “l”; “e”; “2”; “0”; “2”; “2”; “ ”})*1 →`

`returns numeric values for the number strings and`

`#VALUE`

`error for the text strings after multiplication with`

`1`

`Output →`

`{1; 8; 0; 1; #VALUE; #VALUE; #VALUE; #VALUE; #VALUE; 2; 0; 2; 2; #VALUE}`

`ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4)+1)), 1) *1)`

`becomes`

`ISNUMBER({1; 8; 0; 1; #VALUE; #VALUE; #VALUE; #VALUE; #VALUE; 2; 0; 2; 2; #VALUE}) →`

`returns`

`TRUE`

`for the numeric values otherwise`

`FALSE`

`.`

`Output →`

`{TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; TRUE; TRUE; TRUE; FALSE}`

`MATCH(FALSE, ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4)+1)), 1) *1), 0)`

`becomes`

`MATCH(FALSE, {TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; TRUE; TRUE; TRUE; FALSE}, 0) →`

`returns the position of first`

`FALSE`

`in the array`

`Output →`

`5`

`LEFT(B4, MATCH(FALSE, ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4)+1)), 1) *1), 0) -1)`

`becomes`

`LEFT("1801apple2022", 5-1)`

`LEFT("1801apple2022", 4) →`

`returns the`

`4`

`characters from left.`

`Output →`

`1801`

`VALUE(LEFT(B4, MATCH(FALSE, ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4)+1)), 1) *1), 0) -1))`

`becomes`

`VALUE(1801) →`

`converts the string into a numeric value`

`Output →`

`1801`

`IFERROR(VALUE(LEFT(B4, MATCH(FALSE, ISNUMBER(MID(B4, ROW(INDIRECT("1:"&LEN(B4)+1)), 1) *1), 0) -1))," ")`

`becomes`

`IFERROR(1801, "") →`

`returns a blank for any error`

`Output →`

`1801`

➤ Press **ENTER** and drag down the **Fill Handle **tool.

Eventually, you will get the specific numbers at the start of the cell and you can extract any number of values by using this formula.

*For using other versions except for Microsoft Excel 365, press CTRL+SHIFT+ENTER *instead of pressing

**.**

*ENTER*## 9. Getting All Numbers from Any Position of Cells in Excel

Here, we will gather all of the numeric values which means the ID numbers and the years together in the **ID No.&Year **column with the help of the **SUMPRODUCT**, **MID**, **LARGE**, **INDEX**, **ISNUMBER**, **ROW**, **INDIRECT**, **LEN **functions.

** Steps**:

➤ Type the following function in cell

**C4**.

`=SUMPRODUCT(MID(0&B4, LARGE(INDEX(ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4))), 0), ROW(INDIRECT("1:"&LEN(B4))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(B4)))/10)`

Here, **B4 **is the ** Product Code**.

`0&B4`

`becomes`

`01801apple2022`

`LEN(B4) →`

`gives the length of the total characters in the product code of cell`

`B4`

`.`

`Output →`

`13`

`INDIRECT("1:"&LEN(B4))`

`becomes`

`INDIRECT("1:"&13)`

`INDIRECT("1:13") →`

`gives the reference to this range`

`Output →`

`$1:$13`

`ROW(INDIRECT("1:"&LEN(B4)))`

`becomes`

`ROW(INDIRECT($1:$13) →`

`returns the row numbers serially in this range`

`Output →`

`{1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13}`

`MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)`

`becomes`

`MID("1801apple2022", {1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13}, 1) →`

`returns an array of extracted texts for the array of different starting positions.`

`Output →`

`{“1”; “8”; “0”; “1”; “a”; “p”; “p”; “l”; “e”; “2”; “0”; “2”; “2”}`

`ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1))`

`becomes`

`ISNUMBER(--({“1”; “8”; “0”; “1”; “a”; “p”; “p”; “l”; “e”; “2”; “0”; “2”; “2”})) →`

`the double negation converts the numeric strings into numbers and then`

`ISNUMERIC`

`will return`

`TRUE`

`for the numbers.`

`Output →`

`{TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; TRUE; TRUE; TRUE}`

`ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4)))`

`becomes`

`{TRUE; TRUE; TRUE; TRUE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE; TRUE; TRUE; TRUE}*{1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13}`

`Output →`

`{1; 2; 3; 4; 0; 0; 0; 0; 0; 10; 11; 12; 13}`

`INDEX(ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4))), 0)`

`becomes`

`INDEX({1; 2; 3; 4; 0; 0; 0; 0; 0; 10; 11; 12; 13}, 0)`

`Output →`

`{1; 2; 3; 4; 0; 0; 0; 0; 0; 10; 11; 12; 13}`

`LARGE(INDEX(ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4))), 0), ROW(INDIRECT("1:"&LEN(B4))))`

`becomes`

`LARGE({1; 2; 3; 4; 0; 0; 0; 0; 0; 10; 11; 12; 13}, {1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13}) →`

`arranges the numbers in the array from large to small values`

`Output →`

`{13; 12; 11; 10; 4; 3; 2; 1; 0; 0; 0; 0; 0}`

`LARGE(INDEX(ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4))), 0), ROW(INDIRECT("1:"&LEN(B4))))+1`

`becomes`

`{13; 12; 11; 10; 4; 3; 2; 1; 0; 0; 0; 0; 0}+1`

`Output →`

`{14; 13; 12; 11; 5; 4; 3; 2; 1; 1; 1; 1; 1}`

`MID(0&B4, LARGE(INDEX(ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4))), 0), ROW(INDIRECT("1:"&LEN(B4))))+1, 1)`

`becomes`

`MID(01801apple2022, {14; 13; 12; 11; 5; 4; 3; 2; 1; 1; 1; 1; 1}, 1)`

`Output →`

`{“2”, “2”, “0”, “2”, “1”, “0”, “8”, “1”, “0”, “0”, “0”, “0”, “0”}`

`MID(0&B4, LARGE(INDEX(ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4))), 0), ROW(INDIRECT("1:"&LEN(B4))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(B4)))`

`becomes`

`{“2”, “2”, “0”, “2”, “1”, “0”, “8”, “1”, “0”, “0”, “0”, “0”, “0”} * 10^{1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13}`

`Output →`

`{20; 200; 0; 20000; 100000; 0; 80000000; 100000000; 0; 0; 0; 0; 0}`

`MID(0&B4, LARGE(INDEX(ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4))), 0), ROW(INDIRECT("1:"&LEN(B4))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(B4)))/10`

`becomes`

`{20; 200; 0; 20000; 100000; 0; 80000000; 100000000; 0; 0; 0; 0; 0}/10`

`Output →`

`{2; 20; 0; 2000; 10000; 0; 8000000; 10000000; 0; 0; 0; 0; 0}`

`SUMPRODUCT(MID(0&B4, LARGE(INDEX(ISNUMBER(--MID(B4, ROW(INDIRECT("1:"&LEN(B4))), 1)) * ROW(INDIRECT("1:"&LEN(B4))), 0), ROW(INDIRECT("1:"&LEN(B4))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(B4)))/10)`

`becomes`

`SUMPRODUCT({2; 20; 0; 2000; 10000; 0; 8000000; 10000000; 0; 0; 0; 0; 0})`

`Output →`

`18012022`

➤ Press **ENTER** and drag down the **Fill Handle **tool.

Finally, we will get the combination of our specified numbers.

*For using other versions except for Microsoft Excel 365, press CTRL+SHIFT+ENTER *instead of pressing

**.**

*ENTER*## 10. Using Excel’s Convert Text to Columns Wizard to Get Specific Numbers

In this section, we will use the **Text to Columns** option to **separate the decimal numbers** from the product codes in the **ID No. **column.

** Steps**:

➤ Select the range and then go to the

**Data**Tab >>

**Data Tools**Group >>

**Text to Columns**Option.

After that, the **Convert Text to Columns Wizard **will appear.

➤ Click on the **Fixed width **option and press **Next **in the first step.

Then, you will be taken to ** Step-2 **of the wizard.

➤ Click on the position where you want the separation (as we want to have the division after the

**ID Numbers**so we have clicked after it)

➤ Press

**Next**.

Finally, you will reach the final step.

➤ Select and write the followings.

**Column data format → General
**

**Destination → $C$4**

➤ Press

**Finish**.

Ultimately, we will have our desired *ID Numbers *in the **ID No. **column.

## 11. Using VBA Macro to Extract Specific Numbers from a Cell

In this section, we are going to use a **VBA code **to remove numbers from the string.

** Steps**:

➤ Go to the

**Developer**Tab >>

**Visual Basic**Option.

Then, the **Visual Basic Editor **will open up.

➤ Go to the **Insert **Tab >> **Module **Option.

After that, a **Module** will be created.

➤ Write the following code

```
Sub gettingspecificnumbers()
Dim number As Range
For Each number In Range("B4:B11")
If InStr(number.Value, "2022") > 0 Then
number.Offset(0, 1).Value = Mid(number.Value, InStr(number.Value, "2022"), 4)
Else
number.Offset(0, 1).Value = ""
End If
Next number
End Sub
```

Here, we have declared the **number** as **Range**, and it will store each value of the cells for the range **B4:B11** within the **FOR loop**. **IF** statement will check whether the values contain a specific portion of ** 2022 **with the help of the

**InStr function**which looks for a partial match.

For matching the criteria we will extract the portion

**from the strings in the adjacent cells.**

*2022*➤ Press **F5**.

In this way, you will get the years in the **Year **column after the extraction from the codes.

**Download Practice Workbook**

## Conclusion

In this article, we tried to cover the ways to extract specific numbers from a cell in Excel easily. Hope you will find it useful. If you have any suggestions or questions, feel free to share them in the comment section.

**<< Go Back to Separate Numbers Text | Split | Learn Excel**