How do I nest a MATCH inside a SEARCH?

jamieraitt

New Member
Joined
Mar 21, 2022
Messages
9
Office Version
  1. 2019
Platform
  1. Windows
Hello,

First post in here and new to Excel in general, so go easy! Also, if there is a simpler method of doing this then please tell me!

I have been given a spreadsheet which contains the finishing positions of several races in a season. Unfortunately, it's not that easy to do any analysis on in the current format, which is:

BAH MON HUN etc...
1st GLY SWF SWF
2nd NAG JEF BLI
3rd WHI BLI LAW
etc...

I'm trying to get it into a format like this:

BAH MON HUN
BLI 11 3 2
GLY 1 12 DNF
JEF 8 2 11

On the sheet I have been given, if a player has a DNF (Did Not Finish), they have an "x" in front of their abbreviated name. So if this is the case, rather than a finishing position being displayed, I need the cell to display "DNF".

The problem I am having currently, is that I am only able to get the SEARCH part of the formula to apply to one cell. The formula is as follows:

=IF(ISNUMBER(SEARCH("x",'ResultsS8 '!C18)),"DNF",(MATCH("*"&$A$2:$A$24&"*",'ResultsS8 '!C:C,0))-1)

The MATCH part is working correctly, and the "DNF" displays when it should (if I remove the "x" from the front of the abbreviated name on the original sheet, the correct number displays on the new sheet). But I'm only able to get it working when referencing one cell at the moment (C18 in this instance). Am I able to nest the correctly working MATCH function within the SEARCH function? Or is there a better way of getting the same end result?

Many thanks in advance!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Welcome to Mr. Excel

If you use XL2BB to show your sample data and results you're looking for, you stand a better chance of someone replying. It's difficult to recreate what your sheet looks like without data.
 
Upvote 0
Hello,

First post in here and new to Excel in general, so go easy! Also, if there is a simpler method of doing this then please tell me!

I have been given a spreadsheet which contains the finishing positions of several races in a season. Unfortunately, it's not that easy to do any analysis on in the current format, which is:

BAH MON HUN etc...
1st GLY SWF SWF
2nd NAG JEF BLI
3rd WHI BLI LAW
etc...

I'm trying to get it into a format like this:

BAH MON HUN
BLI 11 3 2
GLY 1 12 DNF
JEF 8 2 11

On the sheet I have been given, if a player has a DNF (Did Not Finish), they have an "x" in front of their abbreviated name. So if this is the case, rather than a finishing position being displayed, I need the cell to display "DNF".

The problem I am having currently, is that I am only able to get the SEARCH part of the formula to apply to one cell. The formula is as follows:

=IF(ISNUMBER(SEARCH("x",'ResultsS8 '!C18)),"DNF",(MATCH("*"&$A$2:$A$24&"*",'ResultsS8 '!C:C,0))-1)

The MATCH part is working correctly, and the "DNF" displays when it should (if I remove the "x" from the front of the abbreviated name on the original sheet, the correct number displays on the new sheet). But I'm only able to get it working when referencing one cell at the moment (C18 in this instance). Am I able to nest the correctly working MATCH function within the SEARCH function? Or is there a better way of getting the same end result?

Many thanks in advance!
GPR_Current - Jamie.xlsx
ABCD
1PositionBahrainMonzaHungary
21GLYSWFSWF
32NAGJEFBLI
43WHIBLILAW
54RAKRAIDOO
65SWFLAWEAR
76LAWRAKWIL
87RAIWILWHI
98JEFHWKQAT
109WILTOWRAK
1110HWKWHIRAI
1211BLINAGJEF
1312DOOGLYGRE_
1413EAREARxTOW
1514QATrERAxrMOR
1615GREGRE
1716rERAQAT_
1817xTOWxDOO
1918
2019
ResultsS8
 
Upvote 0
GPR_Current - Jamie.xlsx
ABCD
1Driver Name BahrainMonzaHungary
2BEE#N/A#N/A#N/A
3BLI1132
4BUL#N/A#N/A#N/A
5DOO12DNF4
6EAR13135
7GLY112#N/A
8GRE151512
9HWK108#N/A
10HWT#N/A#N/A#N/A
11JEF8211
12LAW653
13LIN#N/A#N/A#N/A
14MRV#N/A#N/A#N/A
15MOR#N/A#N/A14
16NAG211#N/A
17QAT14168
18RAI0410
19RAK469
20SWF511
21TOW17913
22WHI3107
23WIL976
24WOU#N/A#N/A#N/A
New Results Sheet
Cell Formulas
RangeFormula
B6:D24,B5,D2:D5,B2:C4B2=MATCH("*"&$A$2:$A$24&"*",'ResultsS8 '!B:B,0)-1
C5C5=IF(ISNUMBER(SEARCH("x",'ResultsS8 '!C18)),"DNF",(MATCH("*"&$A$2:$A$24&"*",'ResultsS8 '!C:C,0))-1)
 
Upvote 0
Welcome to Mr. Excel

If you use XL2BB to show your sample data and results you're looking for, you stand a better chance of someone replying. It's difficult to recreate what your sheet looks like without data.
Thanks very much! I've included them now
 
Upvote 0
Upvote 0
Solution
Adjustment for a few of the quirky ones:

Book10
ABCD
1Driver NameBahrainMonzaHungary
2BEE#N/A#N/A#N/A
3BLI1132
4BUL#N/A#N/A#N/A
5DOO12DNF4
6EAR13135
7GLY112#N/A
8GRE151512
9HWK108#N/A
10HWT#N/A#N/A#N/A
11JEF8211
12LAW653
13LIN#N/A#N/A#N/A
14MRV#N/A#N/A#N/A
15MOR#N/A#N/ADNF
16NAG211#N/A
17QAT14168
18RAI7410
19RAK469
20SWF511
21TOWDNF9DNF
22WHI3107
23WIL976
24WOU#N/A#N/A#N/A
25ERA1614#N/A
Sheet2
Cell Formulas
RangeFormula
B2:D25B2=IF("x"=LEFT(INDEX('ResultsS8 '!B$2:B$18,MATCH("*"&$A2&"*",'ResultsS8 '!B$2:B$18,0)),1),"DNF",MATCH("*"&$A2&"*","*"&'ResultsS8 '!B$2:B$18,0))
 
Upvote 0
Welcome to the MrExcel board!
  1. What does the "r" prefix mean (retired?) and how should that be treated when assessing the position?
  2. What does the "xr" prefix mean and how should it be treated when assessing the position?
  3. What does the "_" suffix mean and how should it be treated when assessing the position?
 
Upvote 0
Adjustment for a few of the quirky ones:

Book10
ABCD
1Driver NameBahrainMonzaHungary
2BEE#N/A#N/A#N/A
3BLI1132
4BUL#N/A#N/A#N/A
5DOO12DNF4
6EAR13135
7GLY112#N/A
8GRE151512
9HWK108#N/A
10HWT#N/A#N/A#N/A
11JEF8211
12LAW653
13LIN#N/A#N/A#N/A
14MRV#N/A#N/A#N/A
15MOR#N/A#N/ADNF
16NAG211#N/A
17QAT14168
18RAI7410
19RAK469
20SWF511
21TOWDNF9DNF
22WHI3107
23WIL976
24WOU#N/A#N/A#N/A
25ERA1614#N/A
Sheet2
Cell Formulas
RangeFormula
B2:D25B2=IF("x"=LEFT(INDEX('ResultsS8 '!B$2:B$18,MATCH("*"&$A2&"*",'ResultsS8 '!B$2:B$18,0)),1),"DNF",MATCH("*"&$A2&"*","*"&'ResultsS8 '!B$2:B$18,0))

How about this?

Book10
ABCD
1Driver NameBahrainMonzaHungary
2BEE#N/A#N/A#N/A
3BLI1132
4BUL#N/A#N/A#N/A
5DOO12DNF4
6EAR13135
7GLY112#N/A
8GRE1515#N/A
9HWK108#N/A
10HWT#N/A#N/A#N/A
11JEF8211
12LAW653
13LIN#N/A#N/A#N/A
14MRV#N/A#N/A#N/A
15MOR#N/A#N/ADNF
16NAG211#N/A
17QAT14#N/A8
18RAI7410
19RAK469
20SWF511
21TOWDNF9DNF
22WHI3107
23WIL976
24WOU#N/A#N/A#N/A
Sheet2
Cell Formulas
RangeFormula
B2:D24B2=IF("x"=LEFT(INDEX('ResultsS8 '!B$2:B$18,MATCH("*"&$A2,'ResultsS8 '!B$2:B$18,0)),1),"DNF",MATCH($A2,'ResultsS8 '!B$2:B$18,0))
This one worked perfectly! When I used the second one, the numbers came up as "VALUE!" (would that be because of the &"*" after the A2 cell reference?), but I've checked this one in various places across the whole season and it all seems great. Thank you so much!
 
Upvote 0
Welcome to the MrExcel board!
  1. What does the "r" prefix mean (retired?) and how should that be treated when assessing the position?
  2. What does the "xr" prefix mean and how should it be treated when assessing the position?
  3. What does the "_" suffix mean and how should it be treated when assessing the position?
Hi Peter

1. The "r" prefix means "reserve". There were a few stand-ins throughout the season. This doesn't affect any points awarded for finishing position.
2. The "x" means the driver Did Not Finish, and the "r" is as stated above. They have just been lumped together in some instances.
3. The "_" suffix means that the driver had been lapped in the race. This doesn't affect a driver's points for that race, but it does affect the points a team can score. If both drivers finish on the lead lap, the team gets an extra 5 points. Whilst I'm not concerned with this at the moment as I'm only looking at individual performances, this might be something I need to explore later!
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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