Return column header where partial text is found

RockChalk

New Member
Joined
Nov 29, 2022
Messages
7
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have multiple categories, each of which has some values. In my sheet, I am trying to find what "category" a specific cell contains. The range would contain the partial text of the cell however.

Basically, my if statement is if e4 contains an "M" then it = v2, if not then check $g$2:$v15 to see if any of those values are matches or partial matches of c4, and if none of them are found, then u2.

I have attempted index:match, if/countifs, I continually get the #N/A result, regardless of my attempt at a formula.

Clearly, I'm new to this:

This is what I'm hoping to yield with the formula (f4:f17) instead of the the *N/A.
 

Attachments

  • 2022-11-29_13h49_34.png
    2022-11-29_13h49_34.png
    105.8 KB · Views: 14

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
It is achievable.

Please upload that data using the tool listed in my signature below. That way, we can help you without having to type all that in.
 
Upvote 0
v18offensecodes.xlsx
ABCDEFGHIJKLMNOPQRSTUV
1Version 18 Code OrderOffense Categories
2Offense CodeLiteralCitationStatuteL/DOffense CategoryCap MurMurderOth HomAgg AsltSex AsltIndecencyFam ViolRobberyBurglaryTheftAuto TheftDrug SaleDrug PossFel DWIOth FelAll Misd
303990001MISREPRESENT CHILD AS FAMILY MEMBER ENTRY PORT37.082(c)PCMBAll Misd19.0319.0219.0422.0122.01122.01122.01(B)(2)29.0330.0231*31.03481481*49.04
409990017MANSLAUGHTER19.04PCF2*Oth Hom19.0522.0422.02122.02171.0021(B)29.0230.0432.3131.07482483*49.045
509990018CRIM NEGLIGENT HOMICIDE19.05PCFS*Oth Hom49.0822.0521.0271.00333A.0448349.09
609990020CAPITAL MURDER OF A PEACE OFFICER OR FIREMAN19.03(a)(1)PCFX*Cap Mur22.0721.1171.00548549.07
709990021MURDER UNDER INFLUENCE OF SUDDEN PASSION19.02(d)PCF2*Mur22.0821.12
809990022CAPITAL MURDER BY TERROR THREAT/OTHER FELONY19.03(a)(2)PCFX#N/A22.015
909990023CAPITAL MURDER WHILE REMUNERATION19.03(a)(3)PCFX#N/A22.02
1009990024CAPITAL MURDER PERSON WHILE ESCAPING/ATTEMPT19.03(a)(4)PCFX#N/A22.041
1109990025CAPITAL MURDER OF ANOTHER PERSON IN PRISON19.03(a)(5-6)PCFX#N/A22.09
1209990026CAPITAL MURDER OF MULTIPLE PERSONS19.03(a)(7)PCFX#N/A22.11
1309990029CAPITAL MURDER OF PERSON UNDER TEN YOA19.03(a)(8)PCFX#N/A15.01
1409990030MURDER19.02(c)PCF1#N/A19.02
1509990031CAPITAL MURDER OF PERSON =>10YOA<15YOA19.03(a)(9)PCFX#N/A19.03
1609990032CAPITAL MURDER FOR RETALIATION JUDGE/JUSTICE19.03(a)(10)PCFX#N/A
1710050001UNLAWFUL RESTRAINT LESS THAN 17 YRS OF AGE20.02(c)(1)PCFS#N/A
1810990001KIDNAPPING20.03(a)PCF3*Oth Fel
1910990002AGREEMENT TO ABDUCT FROM CUSTODY25.031PCFS#N/A
2010990007AGG KIDNAPPING FOR RANSOM/REWARD20.04(a)(1)PCF1#N/A
2110990008AGG KIDNAPPING FOR RANSOM/REWARD SAFE RELEASE20.04(d)PCF2#N/A
2210990009AGG KIDNAPPING USE AS SHIELD/HOSTAGE20.04(a)(2)PCF1#N/A
2310990010AGG KIDNAPPING USE AS SHIELD/HOSTAGE SAFE REL20.04(d)PCF2#N/A
2410990011AGG KIDNAPPING FACILITATE20.04(a)(3)PCF1#N/A
2510990012AGG KIDNAPPING FACILITATE SAFE RELEASE20.04(d)PCF2
2610990015AGG KIDNAPPING TERRORIZE20.04(a)(5)PCF1
2710990016AGG KIDNAPPING TERRORIZE SAFE RELEASE20.04(d)PCF2
2810990017AGG KIDNAPPING INTERFERE PERFORMANCE20.04(a)(6)PCF1
2910990018AGG KIDNAPPING INTERFERE PERFORMANCE SAFE REL20.04(d)PCF2
3010990019UNLAWFUL RESTRAINT20.02(c)PCMA
3110990020UNLAWFUL RESTRAINT:EXPOSE TO SBI20.02(c)(2)(A)PCF3
3210990021AGG KIDNAPPING W/ DEADLY WEAPON20.04(b)PCF1
3310990022AGG KIDNAPPING W/ DEADLY WEAPON SAFE RELEASE20.04(d)PCF2
3410990023AGG KIDNAPPING SEXUAL ABUSE20.04(a)(4)PCF1
3510990024AGG KIDNAPPING SEXUAL ABUSE SAFE RELEASE20.04(d)PCF2
3610990025AGG KIDNAPPING BOD INJURY20.04(a)(4)PCF1
3710990026AGG KIDNAPPING BOD INJURY ABUSE SAFE RELEASE20.04(d)PCF2
3810999999KIDNAPPING CLASS CCLASS CXMC
3911990001SEXUAL ASSLT22.011(a)(1)PCF2
Table 1
Cell Formulas
RangeFormula
F3,F19:F24,F8:F17F3=IF(COUNTIF(E3,"*M*"),$V$2,INDEX($G$2:$V$15,MATCH(C3&"*",$G$2:$V$15,-1)))
Named Ranges
NameRefers ToCells
Agg_Aslt='Table 1'!$J$3:$J$15F3, F19:F24, F8:F17
Auto_Theft='Table 1'!$Q$3:$Q$4F3, F19:F24, F8:F17
Burglary='Table 1'!$O$3:$O$4F3, F19:F24, F8:F17
Cap_Mur='Table 1'!$G$3F3, F19:F24, F8:F17
Drug_Poss='Table 1'!$S$3:$S$4F3, F19:F24, F8:F17
Drug_Sale='Table 1'!$R$3:$R$6F3, F19:F24, F8:F17
Fam_Viol='Table 1'!$M$3:$M$6F3, F19:F24, F8:F17
Fel_DWI='Table 1'!$T$3:$T$6F3, F19:F24, F8:F17
Indecency='Table 1'!$L$3:$L$7F3, F19:F24, F8:F17
Murder='Table 1'!$H$3F3, F19:F24, F8:F17
Oth_Hom='Table 1'!$I$3:$I$5F3, F19:F24, F8:F17
Robbery='Table 1'!$N$3:$N$4F3, F19:F24, F8:F17
Sex_Aslt='Table 1'!$K$3:$K$4F3, F19:F24, F8:F17
Theft='Table 1'!$P$3:$P$5F3, F19:F24, F8:F17
 
Upvote 0
DR, I manually entered some values in column F (with an *) to show you how they should read.
One thing that I did not add in this particular formula was the last value if everything is false, which should be "Oth Fel", so I do know that not all cells will return a value. Thanks,
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

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