Counting occurrences - how to use the cell reference instead of the text string

mkl1

New Member
Joined
May 30, 2012
Messages
14
Office Version
  1. 365
Hi there.
I wish to count occurrences of a text string that is sitting in Column A. I want to count occurrences for around 50 different text strings in that column (i.e. there are 50 rows), for my IPC codes which are in a separate sheet within my workbook.
So I am using the following formula for the row that has the entry "H01M10/0525" in Column A:

=SUM(LEN(Table24[IPC Codes])-LEN(SUBSTITUTE(Table24[IPC Codes],"H01M10/0525","")))/LEN("H01M10/0525")

It works perfectly well, however, I do not want to have to enter the text string from Column A separately for each of the rows - is there a way to tell Excel to use whatever text is in Column A rather than inputting it manually?

Many thanks

MKL
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
It works perfectly well, however, I do not want to have to enter the text string from Column A separately for each of the rows - is there a way to tell Excel to use whatever text is in Column A rather than inputting it manually?
If I am understanding you correctly, then just replace the hard-coded value with the cell that contains the value you are looking for.
For example, if cell A1 contains "H01M10/0525" then just change your formula to:
Excel Formula:
=SUM(LEN(Table24[IPC Codes])-LEN(SUBSTITUTE(Table24[IPC Codes],A1,"")))/LEN(A1)
Then, if you copy that formula down the column, the references of A1 will change to A2, then A3, etc.

So is that what you are looking for?
 
Upvote 0
Solution
If I am understanding you correctly, then just replace the hard-coded value with the cell that contains the value you are looking for.
For example, if cell A1 contains "H01M10/0525" then just change your formula to:
Excel Formula:
=SUM(LEN(Table24[IPC Codes])-LEN(SUBSTITUTE(Table24[IPC Codes],A1,"")))/LEN(A1)
Then, if you copy that formula down the column, the references of A1 will change to A2, then A3, etc.

So is that what you are looking for?
Hi there Joe,

Thanks - unfortunately this does not work.
 
Upvote 0
If I am understanding you correctly, then just replace the hard-coded value with the cell that contains the value you are looking for.
For example, if cell A1 contains "H01M10/0525" then just change your formula to:
Excel Formula:
=SUM(LEN(Table24[IPC Codes])-LEN(SUBSTITUTE(Table24[IPC Codes],A1,"")))/LEN(A1)
Then, if you copy that formula down the column, the references of A1 will change to A2, then A3, etc.

So is that what you are looking for?
Hi - yes this did work - I just needed to make the first entry A3 - thanks this is great!
 
Upvote 0
You are welcome.
Glad I was able to help.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

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