How can I check if a cell contains a certain word, than if it does copy the next numbers to another cell?

Phantasm

Board Regular
Joined
Nov 2, 2007
Messages
58
Cell P15 contains a bunch of job notes like the following:

"PROGRAM # 7046
LVL # 001
PANEL DOOR INNER DIVAN 650
INCLUDES 72.67 INCHES OF 5-AXIS TRIM
CUSTOMER TO SUPPLY .047 IN. THK. CARBON FIBER FORMED PARTS
PART SHARES A COMMON FIXTURE WITH 39593
RESET-UP OF JOB #17052
GREEN TRIM LINE ON CUSTOMER FIXTURE"

What I need to do is get the program number (7046 in this case) and populate textbox1 on a userform with it. Also, I would like to populate textbox 2 with the lvl number (001 in this case). how would I go about doing this? My first thought was to search for the terms "PROGRAM" & "LVL" within the cell, but I dont know how to select what I need after that. Program number isnt always on the first line & I have seen them use "PRG" sometimes, so it gets even more complicated...
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Whew, that was a bit complex, but think I have something that may work. It's assuming that "PROGRAM #" or "PRG #" precedes the program# and "LVL #" precedes the level#
PROGRAM # 7046 LVL # 001 PANEL DOOR INNER DIVAN 650 INCLUDES 72.67 INCHES OF 5-AXIS TRIM CUSTOMER TO SUPPLY .047 IN. THK. CARBON FIBER FORMED PARTS PART SHARES A COMMON FIXTURE WITH 39593 RESET-UP OF JOB #17052 GREEN TRIM LINE ON CUSTOMER FIXTURE7046001
Bunch a junk PRG # 4076 LVL # 003 PANEL DOOR INNER DIVAN 650 INCLUDES 72.67 INCHES OF 5-AXIS TRIM CUSTOMER TO SUPPLY .047 IN. THK. CARBON FIBER FORMED PARTS PART SHARES A COMMON FIXTURE WITH 39593 RESET-UP OF JOB #17052 GREEN TRIM LINE ON CUSTOMER FIXTURE4076003

<tbody>
</tbody>

In Q15 place:
Code:
=LEFT(TRIM(SUBSTITUTE(SUBSTITUTE(MID(P15,IFERROR(FIND("PROGRAM #",P15),IFERROR(FIND("PRG #",P15),0)),30),"PROGRAM #",""),"PRG #","")),FIND(" ",TRIM(SUBSTITUTE(SUBSTITUTE(MID(P15,IFERROR(FIND("PROGRAM #",P15),IFERROR(FIND("PRG #",P15),0)),30),"PROGRAM #",""),"PRG #",""))) -1)
In R15 place:
Code:
=LEFT(TRIM(SUBSTITUTE(MID(P15,IFERROR(FIND("LVL #",P15),0),30),"LVL #","")),FIND(" ",TRIM(SUBSTITUTE(MID(P15,IFERROR(FIND("LVL #",P15),0),30),"LVL #",""))) -1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,011
Messages
6,122,680
Members
449,091
Latest member
peppernaut

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