Extract Number From Different Positions in Cells

Justinian

Well-known Member
Joined
Aug 9, 2009
Messages
1,557
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet with suite numbers and I need to extract only the number from each cell. The problem is that the numbers are in different positions or are sometimes not the only number in that cell. For example, the cell could look like this:

- Twr 1B

In this case, I need to extract the 1 (indicating 1 bedroom)

Other examples could look like this:

- G 1B L

In this case, I need to extract the 1 (indicating 1 bedroom)

Or they could look like this:

- Twr2S#1 or T1Sig#5

In these cases, I need to extract the first number, 2 in the first example and 1 in the second example, excluding the #5 that precedes the "S#" or the "Sig#"
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
If your data is in A1, place this formula in B1 (copy down as necessary):
=MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),1)
 
Last edited:
Upvote 0
Perfect! Now how do I combine that with my existing VLOOKUP?

=VLOOKUP(A1,Units,2,FALSE)
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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