Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
RYD@wolpofflaw
 
Posts: n/a
Default Tally occurences of phrase on one sheet.

I have several sheets of information. What I'm looking to do is tally the
occurences of a specific phrase "ABC" in one column, and place that tally on
a separate sheet. Anyone have any ideas.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default Tally occurences of phrase on one sheet.

The following code assumes that the data starts in column A, row 1 on a
worksheet that is not Sheet3 and that the workbook has at least 3 worksheets.

The macor is run while you are in the sheet containing the data you wish to
count

Sub CountABC()

Dim varVal As Variant
Dim lABCCount As Long
Dim lOffset As Long

Range("A1").Select
varVal = ActiveCell.Value

'loop down column A and count each occurrence of the
'string ABC storing to a variable lABCCount
'Increment the row offset variable lOffset by 1 and pick
'up the value in the next cell in column A

Do Until varVal = ""
If varVal = "ABC" Then
lABCCount = lABCCount + 1
End If
lOffset = lOffset + 1
varVal = ActiveCell.Offset(lOffset).Value
Loop

'Activate Sheet3 and select cell A1
'Post the count value
Sheets("Sheet3").Activate
Range("A1").Select
ActiveCell.Value = lABCCount

End Sub

--
Kevin Backmann


"RYD@wolpofflaw" wrote:

I have several sheets of information. What I'm looking to do is tally the
occurences of a specific phrase "ABC" in one column, and place that tally on
a separate sheet. Anyone have any ideas.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Index/Contents Sheet philiphales Excel Discussion (Misc queries) 2 September 9th 05 08:58 AM
In Excel, how do you make one whole sheet equal to another. ryan Excel Discussion (Misc queries) 2 August 31st 05 07:03 PM
Clicking Cell Link Changes Cell on Another Sheet nshah Excel Discussion (Misc queries) 1 August 31st 05 01:50 AM
Get other sheet names into a column Keyser Excel Worksheet Functions 2 August 27th 05 02:02 AM
Using a relative SHEET reference for source data in a chart James Charts and Charting in Excel 6 August 16th 05 05:07 PM


All times are GMT +1. The time now is 04:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"