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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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#
[TABLE="class: grid, width: 900"]
<tbody>[TR]
[TD]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[/TD]
[TD]7046[/TD]
[TD]001[/TD]
[/TR]
[TR]
[TD]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 FIXTURE[/TD]
[TD]4076[/TD]
[TD]003[/TD]
[/TR]
</tbody>[/TABLE]

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,223,236
Messages
6,170,917
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