sorry - i need vba or formula to find keywords like "large" then extract the number that follow see image.It would be best if you could show us some different examples of what the data may really look like.
It is best not to oversimplify things when posting your questions, or else you may get answers that work for your oversimplified examples, but not for your real data.
Book2 (version 3).xlsb | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Description | Large | Medium | Small | ||
2 | On 9/29/2021 blah blah large 7684 at Orlando blah blah Med. 3255-01 to blah blah blah | 7684 | 3255-01 | #VALUE! | ||
Sheet6 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B2 | B2 | =Xtract(A2,"large") |
C2 | C2 | =Xtract(A2,"Med.") |
D2 | D2 | =Xtract(A2,"small") |
Function Xtract(s As String, prefix As String)
With CreateObject("VBscript.RegExp")
.Pattern = prefix & "\s(\d+\-?\d+)"
Xtract = .Execute(s)(0).submatches(0)
End With
End Function
Book6 | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Description | Large | Med | Small | |||
2 | Friday Sept. 24th 2021, at Orlando station, 1 TRX container, large 7684 was used to ship customer ID 12121214 to Miami. Second shift requested 1 Carry-all, Med. 32555-01 to complete the transport order. First shift noted that Large container will not be enough for all of customers items. Shift manager noted that using the wrong size containers has caused 50% of transportation delays YTD. Small 12345 | 7684 | 32555-01 | 12345 | |||
3 | |||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B2,D2 | B2 | =TRIM(LEFT(SUBSTITUTE(MID($A2,SEARCH(B$1,$A2)+LEN(B$1)+1,99)," ",REPT(" ",99)),99)) |
C2 | C2 | =TRIM(LEFT(SUBSTITUTE(MID($A2,SEARCH(C$1,$A2)+LEN(C$1)+2,99)," ",REPT(" ",99)),99)) |
This worked perfectly for my situation!Is it always like: text - space - numbers?
VBA Code:Sub jec() For Each it In Range("A1:A5") it.Offset(, 1).Value = Split(it)(1) Next End Sub
For Each cell In rng
Quiz = Split(cell.Value)(3)
Next cell