You are here:

# Excel/Identify the specific re-occurrence number of a text string in a column

Question
The "Countif" function will count the total number of identified variables, but I am trying to identify the actual sequential number of the variable found in a list.

Ex:  If the name "Smith" appears in B3,B10,and B24, can a formula in A identify B3 as the first occurrence ("1"), B10 as the second ("2") occurrence of Smith, etc.?

I then want to concatenate "Smith" and "2" to create a unique variable as a look-up value from a table.  (I already do this - "Smith2").

Wayne Frindell,

It would be possible to return the row of that occurance using an array formula.

an easier way might be to go to the next available column (say column F) and in F2 put in a formula

=countif(\$B\$1:\$B2,B2)  and drag fill down column F.  This will give you the occurance number for that particular value in column B.

as you pull that formula down, the first range \$B\$1 will remain fixed - but the second \$B2 will be \$B3 in rows 3,  \$B4 in row 4 and so forth so the countif will produce the sequence number for the re-occurance.

You could then say use the column next to column F (column G)  to combine those results

G2:  =B2&F2

then drag fill that down.

That seems the easiest way to me.

--
Regards,
Tom Ogilvy

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.