find first occurrence of item after something else

palaeontology

Active Member
Joined
May 12, 2017
Messages
444
Office Version
  1. 2016
Platform
  1. Windows
I have the following table of sports fixtures ...
excel query a.JPG


I'm not permitted to edit the way the data is displayed, so I can't add columns to it, nor can I rename a team identifier, for example ... the 8A team in Touch Football ... I can't rename it 'Touch Football 8A'.

So, I'd like to have a way of finding (by formula) where a particular team is, for example, I'd like to find the location of the 8A team in Touch Football.

I'm thinking ... is there a way to find the first occurrence of the name '8A' after the word 'Touch Football' has occurred.

My spreadsheet that I'm using to strip information from the above spreadsheet is seen below ...

excel query b.JPG


So, for example, under the title 'Opponent' I'd like to have a formula that finds the first occurrence of each of those team names (eg: 7A, 7B, 8A, 8B etc etc) after the word 'Touch Football'

I know how to find the nth occurrence of an item, but not the first occurrence after a specific other item has occurred.

Can anyone help with this ?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi,

I hope that the following formula to demonstrate how to get a range between two values

=INDIRECT("A"&MATCH("TOUCH FOOTBALL",$A:$A,0)+1&":A"&MATCH("FOOTBALL - SOCCER",$A:$A,0)-1)

To pick unique values (I think that you know how to do it), you can use the array formula

=IFERROR(INDEX(INDIRECT("A"&MATCH("TOUCH FOOTBALL",$A:$A,0)+1&":A"&MATCH("FOOTBALL - SOCCER",$A:$A,0)-1),MATCH(0,COUNTIFS($E$5:E5,INDIRECT("A"&MATCH("TOUCH FOOTBALL",$A:$A,0)+1&":A"&MATCH("FOOTBALL - SOCCER",$A:$A,0)-1)),0),1),"")


My spreadsheet layout is presented below.

1585995475582.png


Kind regards

Saba
 
Upvote 0
I'd like to find the location of the 8A team in Touch Football.

I'm thinking ... is there a way to find the first occurrence of the name '8A' after the word 'Touch Football' has occurred.
1. Can we be certain that there will be an 8A in the Touch Football section?
2. What do you mean by "location"? Is it a particular column of the table?
3. Can we have the sample data again in a form we can copy to test/demonstrate? XL2BB
 
Upvote 0
Something like this?

=INDEX($B$1:$B$1000,MATCH(1,INDEX((($A$1:$A$1000="9a")*(ROW($A$1:$A$1000)>MATCH("touch football",$A$1:$A$1000,0))),0),0))

Where the 9a and touch football can be cell references.
 
Upvote 0
This is my take on it....
Book1
ABCDEFGHIJKLMNOP
12BASKETBALL
13OpensSt Margaret'sVen 115:00TeamOpponentVenueFieldStart
14Senior ASt Margaret'sVen 214:007ASt Margaret'sVen 1014:00
1510ASt Margaret'sVen 325:007B    
1610BSt Margaret'sVen 445:008ASt Margaret'sVen 844:00
179ASt Margaret'sVen 535:008B    
189BSt Margaret'sVen 624:009ASt Margaret'sVen 634:00
198ASt Margaret'sVen 744:009BSt Margaret'sVen 724:50
207ASt Margaret'sVen 834:0010ASt Margaret'sVen 434:50
21TOUCH FOOTBALL10BSt Margaret'sVen 544:50
22OpensSt Margaret'sVen 135:40Senior ASt Margaret'sVen 236:20
23Senior ASt Margaret'sVen 236:20Senior BSt Margaret'sVen 345:40
24Senior BSt Margaret'sVen 345:40OpensSt Margaret'sVen 135:40
2510ASt Margaret'sVen 434:50
2610BSt Margaret'sVen 544:50
279ASt Margaret'sVen 634:00
289BSt Margaret'sVen 724:50
298ASt Margaret'sVen 844:00
308C (8B Draw)St Margaret'sVen 914:50
317ASt Margaret'sVen 1014:00
327C (7B Draw)St Margaret'sVen 1124:00
33Senior CSt Margaret'sVen 1246:20
Sheet6
Cell Formulas
RangeFormula
M14:M24M14=IFERROR(INDEX($B$1:$F$100,MATCH($L14,OFFSET($A$1:$A$100,MATCH("TOUCH FOOTBALL",$A$1:$A$100,0),0),0)+MATCH("TOUCH FOOTBALL",$A$1:$A$100,0),1),"")
N14:N24N14=IFERROR(INDEX($B$1:$F$100,MATCH($L14,OFFSET($A$1:$A$100,MATCH("TOUCH FOOTBALL",$A$1:$A$100,0),0),0)+MATCH("TOUCH FOOTBALL",$A$1:$A$100,0),3),"")
O14:O24O14=IFERROR(INDEX($B$1:$F$100,MATCH($L14,OFFSET($A$1:$A$100,MATCH("TOUCH FOOTBALL",$A$1:$A$100,0),0),0)+MATCH("TOUCH FOOTBALL",$A$1:$A$100,0),4),"")
P14:P24P14=IFERROR(INDEX($B$1:$F$100,MATCH($L14,OFFSET($A$1:$A$100,MATCH("TOUCH FOOTBALL",$A$1:$A$100,0),0),0)+MATCH("TOUCH FOOTBALL",$A$1:$A$100,0),5),"")


The appropriately equivalent formula of M14. drag across. > edit the column parameter of the INDEX ( as in 1,3,4 or 5) > Then drag down.

Hope that helps
 
Upvote 0

Forum statistics

Threads
1,215,013
Messages
6,122,690
Members
449,092
Latest member
snoom82

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