Return the column number of the nth occurrence in a row

gruebz

New Member
Joined
Nov 10, 2017
Messages
3
Hi, I couldn't find this answered exactly on the forum. Sorry if it has.

I am looking to return the column number of the nth occurrence in a row.

So in the example in the table below, I am looking to return the column number in row 1 of the 2nd (B4) occurrence of the word 'dog' (B3). In this case it would return the number 6 as the 2nd instance of dog is in column F.

ABCDEFG
1catdogcatratmousedogdog
2
3lookupdog
4nth2

<tbody>
</tbody>

Thank you in advance
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Welcome to Mr Excel forum

EDIT
Try this array formula
=SMALL(IF(A1:G1=B3,COLUMN(A1:G1)-COLUMN(A1)+1),B4)
confirmed with Ctrl+Shift+Enter, not just Enter

M.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,086
Messages
6,128,736
Members
449,466
Latest member
Peter Juhnke

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