Looking up based off word after another word

erniepoe

Active Member
Joined
Oct 23, 2006
Messages
375
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I would like to do an Index/Match, but have it look for the first subtotal after a specific persons name.

So my column data looks like this:

John Doe
Blank
Blank
Blank
Subtotal
Jane Doe
Blank
Blank
Blank
Blank
Blank
Subtotal
Jason Doe
Blank
Blank
Subtotal

The number of blank rows after a persons name are dependent on how many line items associated with them, and will vary by person.

Is there a way I can alter the formula to find the first subtotal after Jane Doe, and then find the value in column R? Thanks so much.

=INDEX(R:R,MATCH("subtotal",B:B,0))
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
How about
Fluff.xlsm
ABRSTU
1
2John Doe1jane doe12
3Blank2
4Blank3
5Blank4
6Subtotal5
7Jane Doe6
8Blank7
9Blank8
10Blank9
11Blank10
12Blank11
13Subtotal12
14Jason Doe13
15Blank14
16Blank15
17Subtotal16
18
Sheet6
Cell Formulas
RangeFormula
U2U2=LET(f,FILTER(B2:R1000,(B2:B1000=T2)+(B2:B1000="subtotal")),INDEX(TAKE(f,,-1),XMATCH(T2,TAKE(f,,1))+1))
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Fluff, does it have to be referencing the same tab to work? I turned your formula into this and and is returning a value error, is there a way to fix (or something I am doing wrong?


=LET(f,FILTER('Bookings - Jan 2024'!B2:R1000,('Bookings - Jan 2024'!B2:R1000=E6)+('Bookings - Jan 2024'!B2:R1000="Subtotal")),INDEX(TAKE(f,,-1),XMATCH(E6,TAKE(f,,1))+1))
 
Upvote 0
I'll let Fluff figure out the issue with that formula, but here's another you can try. You should see where to put sheet references.

Book2
ABRSTU
1
2John Doe1Jane Doe12
32
43
54
6Subtotal5
7Jane Doe6
87
98
109
1110
1211
13Subtotal12
14Jason Doe13
1514
1615
17Subtotal16
Sheet8
Cell Formulas
RangeFormula
U2U2=VLOOKUP("Subtotal",OFFSET(Sheet8!B2:R1000,MATCH(T2,Sheet8!B2:B1000,0),0),17,0)
 
Upvote 0
The criteria range should be a single column, so it would be like
Excel Formula:
=LET(f,FILTER('Bookings - Jan 2024'!B2:R1000,('Bookings - Jan 2024'!B2:B1000=E6)+('Bookings - Jan 2024'!B2:B1000="Subtotal")),INDEX(TAKE(f,,-1),XMATCH(E6,TAKE(f,,1))+1))
 
Upvote 0
ah, thank you, Fluff. Silly error on my part. Cheers!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,987
Members
449,093
Latest member
Mr Hughes

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