Populating a column by extracting a variable code from another column

pedexe90

Board Regular
Joined
Apr 18, 2018
Messages
59
Hi everyone,

I would like column D:D to be populated with a function rather than manually. This column contains H codes taken from E:E. The codes are in this format: H0xx-H9xx (4 characters, first character is fixed as H the second character varies from 0 to 9 and the third and fourth characters are random).

I would like one formula to extract the code and return it to column D as seen in the attached file.

Many many thanks.

https://1drv.ms/x/s!AgQdYsSdg735eSFFPKUE3l_bjqM
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You may also enhance my formula, I don't know how to incorporate an OR function to this so it only returns H0xx.

Code:
=IFERROR(MID(E2,SEARCH({"H0","H1","H2","H3","H4","H5","H6","H7","H8","H9"},E2),4),"")
 
Upvote 0
Hi,

This should do what you need:


Book1
DE
2H011Music-Music Tour-HS-(H011)
3H012Music-MS-Honor Boys Choir-(H012)
4H013Music-MS-Honor Band-(H013)
5H014Music-HS Single Ensemble (H014)
6H015Music-HS-Honor Combined Ensembles (H015)
70
80
90
100
11H018Language - French Trip H018
12H196French Field Trip (H196)
13H112Languages-Spanish Trip - H112
140
15H020Music-MS-Honor Mixed Choir-(H020)
16H006China-SL-Trip-(H006-19S)
17H007Lunch/Drinks Program H007
18Fall L.S. After Sch. Program
19Winter L.S. After Sch. Program
20Spring L.S. After Sch. Program
21Summer School(exclude Discount)
22Spring Camp- J Smithies
23Spring School
24H030Theatre Arts-HS-ISTA Festival-(H030)
25H031Theatre Arts-MS-ISTA Festival(H031)
Sheet66
Cell Formulas
RangeFormula
D2=MID(E2,MIN(SEARCH({"H0","H1","H2","H3","H4","H5","H6","H7","H8","H9"},E2&"H0H1H2H3H4H5H6H7H8H9")),4)


D2 formula copied down.
 
Upvote 0

Forum statistics

Threads
1,223,714
Messages
6,174,051
Members
452,542
Latest member
Bricklin

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