Count when a range of cells contains a certain word or phrase
Closed
HABBHR01
Posts
1
Registration date
Thursday April 4, 2013
Status
Member
Last seen
April 8, 2013
-
Apr 8, 2013 at 12:28 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 8, 2013 at 12:02 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 8, 2013 at 12:02 PM
Related:
- Count when a range of cells contains a certain word or phrase
- Word apk for pc - Download - Word processors
- Ms word as pdf or xps - Download - Other
- How to search for a word on a page - Guide
- How to insert a checkmark in word - Guide
- Number to text in word - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Apr 8, 2013 at 12:02 PM
Apr 8, 2013 at 12:02 PM
Hi Hab,
This code will work only if you use quotation marks around the properties.
Otherwise House will also be counted in Beach House.
Column F is used to input the amount of occurrences
Here is the code:
Best regards,
Trowa
This code will work only if you use quotation marks around the properties.
Otherwise House will also be counted in Beach House.
Column F is used to input the amount of occurrences
Here is the code:
Sub CountProperties() Dim x, y, lRowB, lRowE As Integer lRowB = Range("B" & Rows.Count).End(xlUp).Row lRowE = Range("E" & Rows.Count).End(xlUp).Row y = 1 Do y = y + 1 Range("F" & y).ClearContents x = 1 Do x = x + 1 If InStr(Range("B" & x), Range("E" & y)) > 0 Then Range("F" & y) = Range("F" & y) + 1 End If Loop Until x = lRowB Loop Until y = lRowE End Sub
Best regards,
Trowa