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 January 16, 2023 - Apr 8, 2013 at 12:02 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - Apr 8, 2013 at 12:02 PM
Related:
- Count when a range of cells contains a certain word or phrase
- Count if cell contains number - Excel Forum
- Excel if range of cells contains specific text ✓ - Excel Forum
- Word free for u - Guide
- Vim find word - Guide
- If cell contains (multiple text criteria) then return (corresponding text criteria) ✓ - Excel Forum
1 reply
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 16, 2023
545
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