I need some help with a formula. I've got invoices and invoice line items embedded in a field that I need to extract. Below are some examples and what I'm trying extract. As you can see, the invoice and line item# could fall anywhere in the field, could or could not be wrapped in parentheses and sometimes is duplicated in the field for some reason. Also, the data is being pulled from an ODBC connection so a text to columns option won't work for this.
1) I need to extract 140076-1 from below
(INV 140076-1) CAMRY 05 AT, 4 cylinder,Recycled Original Equipment (ROE) - AT, 4 c
2) I need to extract 134421-2 from below
TRANSMISSION ASSY. CORE REFUND INV 134421-2 (INV 134421-2) TRANSMISSION ASSY.
3) I need to extract 139948-2 from below
INV 139948-2 CORE-DUE ALTERNATOR
4) I need to extract 139136-1 from below
(INV 139136-1) (INV 139136-1) (INV 139136-1) (INV 139136-1) (INV 139136-1) (INV 139136-1) (INV 139
I've been using the formula below which gets some of them but not all of them:
=MID(O4,SEARCH("INV",O4)+4,SEARCH(" ",O4,SEARCH(" ",O4)+2)-SEARCH(" ",O4)-2)
Any help would be greatly appreciated. Thanks!
1) I need to extract 140076-1 from below
(INV 140076-1) CAMRY 05 AT, 4 cylinder,Recycled Original Equipment (ROE) - AT, 4 c
2) I need to extract 134421-2 from below
TRANSMISSION ASSY. CORE REFUND INV 134421-2 (INV 134421-2) TRANSMISSION ASSY.
3) I need to extract 139948-2 from below
INV 139948-2 CORE-DUE ALTERNATOR
4) I need to extract 139136-1 from below
(INV 139136-1) (INV 139136-1) (INV 139136-1) (INV 139136-1) (INV 139136-1) (INV 139136-1) (INV 139
I've been using the formula below which gets some of them but not all of them:
=MID(O4,SEARCH("INV",O4)+4,SEARCH(" ",O4,SEARCH(" ",O4)+2)-SEARCH(" ",O4)-2)
Any help would be greatly appreciated. Thanks!