Excel 2003 List with Frequency Count
Not sure where your inputs are coming from. I just used a variable NewWord
tto test the macro. try this
Sub alphabetize()
NewWord = "ccc"
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For RowCount = 1 To Lastrow
If StrComp(NewWord, Cells(RowCount, "A")) = 0 Then
Cells(RowCount, "B") = Cells(RowCount, "B") + 1
Exit Sub
End If
If StrComp(NewWord, Cells(RowCount, "A")) < 0 Then
Cells(RowCount, "A").EntireRow.Insert Shift:=xlDown
Cells(RowCount, "A") = NewWord
Cells(RowCount, "B") = 1
Exit Sub
End If
Next
Cells(Lastrow + 1, "A") = NewWord
Cells(Lastrow + 1, "B") = 1
End Sub
"blazingbadger" wrote:
I'm trying to create a list of alphabetized text items with frequency
count in the adjacent column.
I want to be able to add new entries to the list and then have Excel
compare the new entry to the existing entries and either add the item
if it doesn't exist or update the count next to the existing entry if
already exists.
I've done a lot of searching and haven't found a way to do this,
although it seems like a pretty standard case.
Any ideas?
Thank you!
|