Search a column of cell for a 4 digit number that always starts with the same two digits

BusinessPlanner

New Member
Joined
Jun 24, 2015
Messages
6
Hello,

I need a formula that will search a cell that contains various text and number strings for a specific 4 digit number and return that number to a separate cell.

The 4 digit number always starts with 40 and will therefore be 4001, 4002, 4003 all the way up to 4090.
The 4 digit number will not always be in the same place in the cell (i.e. it could be at the beginning, middle, end, or not there at all).
There will be other numbers in the cell that I don't want returned and other text. A sample is below.

I have been using 'Text to columns' to separate out everything in the cells using spaces and then identify the "40" numbers but this takes far too long and I am dealing with potentially thousands of cells in a column.

Any ideas would be greatly appreciated.

Thanks!

[TABLE="width: 609"]
<colgroup><col width="812" style="width: 609pt; mso-width-source: userset; mso-width-alt: 29696;"> <tbody>[TR]
[TD="width: 812, bgcolor: transparent"]18964 - T111 - PLW - 4051 - PLW - BRAKE SWITCH STICKING[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18964 - T111 - PLW - 4051 - PLW - BRAKE SWITCH STICKING[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18964 - T111 - PLW - 4051 - PLW - BRAKE SWITCH STICKING[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18966 - T112 - 4023 - CEN - B END MOTOR FLASHED[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18966 - T112 - 4023 - CEN - B END MOTOR FLASHED[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18966 - T112 - 4023 - CEN - B END MOTOR FLASHED[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18966 - T112 - 4023 - CEN - B END MOTOR FLASHED[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18966 - T112 - 4023 - CEN - B END MOTOR FLASHED[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18966 - T112 - 4023 - CEN - B END MOTOR FLASHED[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18968 - T132 - 4084 - SJM - DRIVER USED TIME OFF FASSI WHICH WAS 4 MINUTES LATE[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18968 - T132 - 4084 - SJM - DRIVER USED TIME OFF FASSI WHICH WAS 4 MINUTES LATE[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18968 - T132 - 4084 - SJM - DRIVER USED TIME OFF FASSI WHICH WAS 4 MINUTES LATE[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18968 - T132 - 4084 - SJM - DRIVER USED TIME OFF FASSI WHICH WAS 4 MINUTES LATE[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18968 - T132 - 4084 - SJM - DRIVER USED TIME OFF FASSI WHICH WAS 4 MINUTES LATE[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18968 - T132 - 4084 - SJM - DRIVER USED TIME OFF FASSI WHICH WAS 4 MINUTES LATE[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18970- VERTICAL DAMPER FAULT-121-4077-HEB-PLW[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18970- VERTICAL DAMPER FAULT-121-4077-HEB-PLW[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18970- VERTICAL DAMPER FAULT-121-4077-HEB-PLW[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18970- VERTICAL DAMPER FAULT-121-4077-HEB-PLW[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]18970- VERTICAL DAMPER FAULT-121-4077-HEB-PLW[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
This should work, as long as there is the single 40 in the cell.



With something like this example, it returns 40-


Howard


Thanks very much that works great. There will be an issue when the number 40 appears elsewhere in the cell as you point out but this will cover the majority.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,127
Members
453,021
Latest member
Justyna P

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