Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 07-30-2013, 06:17 PM
BobBridges's Avatar
BobBridges BobBridges is offline Trying to count frequency Windows 7 64bit Trying to count frequency Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

I'm not sure whether you noticed, but my solution does give you a count for each word; the problem is that it doesn't give you that count on every row, only on the last row for each word. You can change it around to have it give you the count on the first row of every word, if you prefer.

Here's what's going on: COUNTIF works, alright, except that there are 270 000 rows and therefore 270 000 COUNTIFs, and each one of those 270 000 COUNTIFs has to count all 270 000 rows. That's why it's taking so long. Let's call that solution #1.

Once it's sorted, using the code I gave you—call that solution #2—should work a lot faster. But instead of the answer laid out the way you wanted, it would look like this:

Code:
alphabet  1
alphabet  2
alphabet  3
banana    1
banjo     1
banjo     2
crayon    1
crayon    2
crayon    3
crayon    4
Now, there are two other ways I can think of to do this:

3) In column C use the formula I gave you: "=IF($A2=$A1,$C1+1,1)". Then in column B, use this: "=IF($A2=$A3,$B3,$C2)". Column C counts up the number of each word, just as with my formula in solution #2. But column B looks at column C to display the word count on every row, the way you have it in solution #1; it just works a lot faster. At least, I think it will; I didn't test it with 270K rows.

4) Write a VBA program. This is probably the way I would have done it in the first place, because I'm a programmer at heart. The nice thing about this solution is that it'll work fast and you don't have to sort the words first. Also it can put the the answers in a separate sheet, with one row for each word, as you suggested. The only wrinkle is that you have to be able to write a little program. We can show you how, but you don't want to just copy it; you pretty much have to take the time to learn how it works.

this works for you IN THE SENSE that it gives you a count of each word—only it's not on every row, just on the last row for each word. You could make it on the first row, if you prefer. The problem with your list is that if COUNTIF
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Count Richtriebe Word 1 04-20-2013 11:09 AM
Frequency of a name bryant03 Excel 1 06-27-2012 10:21 AM
How to set frequency of Send?/Receive in Outlook 2010 mikepla Outlook 4 11-03-2011 06:50 AM
How to count the frequency of data and also tally value from an array of Excel record KIM SOLIS Excel 5 09-07-2011 09:01 AM
Trying to count frequency Count By Color beb1227 Excel 4 06-15-2011 08:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft