regex - Extracting several strings from a range of cells -


i have couple thousand of cell need extract document numbers out from. cells have no format ever, every document number starts "doc#-" example

b2:

this example cell showing doc number doc#-12351-2432-1b , second document doc#-2342-rtf-dd-09, there may several more or one. 

i looking way extract document numbers individual numbers, separate cells, line, etc. best way go this?

current have extremely rough formula.

=mid($b2,find("doc#-",$b2,1),find(" ",$b2,find("doc#-",$b2,1))-find("doc#-",$b2,1) 

which: finds first doc, find space after it, returns number mid.

thinking vba way solve this, i'm stumped on how.

select cells wish process , run small macro:

sub qwerty()     dim long, v string, k long     each r in selection         v = replace(r.value, ",", " ")         ary = split(v, "doc#-")         k = 1         = 1 ubound(ary)             bry = split(ary(i), " ")             bry(0) = "doc#-" & bry(0)             r.offset(0, k).value = bry(0)             k = k + 1         next     next r end sub 

it either space or comma terminate document number. here example of input/output:

enter image description here


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -