+ Reply to Thread
Results 1 to 2 of 2

nth occurrence of string in multi-column range

  1. #1
    Registered User
    Join Date
    12-01-2014
    Location
    Belgium
    MS-Off Ver
    Excel Mac 2011
    Posts
    1

    nth occurrence of string in multi-column range

    i got a table of gamescores from multiple (card)games between some players like this:

    A B C D E
    Game 1
    name: An Bert Carol Daniel
    score: 10 5 20 30
    ...other gamedata: ... ... ... ...
    ...other game data: ... ... ... ...
    Game 2
    names: Eric An Bert Carol
    score: 5 10 10 30
    ... other gamedata ... ... ... ...
    ...other gamedata: ... ... ... ...
    Game 3
    names: Carol Fritz Eric An
    score: 5 10 10 30
    ... other gamedata ... ... ... ...
    ...other gamedata: ... ... ... ...

    I need a function that is able to return the index (a function for columnnumber and one for rownumber) of the n'th occurrence of a player name, say "Bert".
    notice that the name "Bert" can appear in different columns, but only once in a row. the nth occurrence is to be counted from top to bottom, across the 4 columns.
    for example the 2nth occurrence of "Bert" is in D8, so i need the function(s) to return 4 (column) and 8 (row), given the inputs "Bert"and 2

    I hope my question is clear. a solution without the use of VBA's or Macro's would be ideal, since i have no experience with those (i am reading up on them)

    thx for any help on the subject

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: nth occurrence of string in multi-column range

    Post in the VBA sub, expect a VBA solution. If you want to use a function, look into VLOOKUP and/or INDEX and MATCH.

    Anyway, here's the VBA. Change Namer and nth to whatever you want, or you could set them equal to an input cell on your spreadsheet if you don't want to change them in the code.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find each occurrence in a column and do for each occurrence
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-21-2014, 12:29 PM
  2. Replies: 3
    Last Post: 09-15-2014, 07:56 PM
  3. Replies: 0
    Last Post: 07-28-2013, 10:24 AM
  4. Replies: 19
    Last Post: 10-05-2012, 01:03 PM
  5. Find the row number of the 2nd occurrence of a string in a range
    By seaottr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2011, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1