Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 11-25-2018, 05:45 AM
p45cal's Avatar
p45cal p45cal is offline need help in counting the number of rows that contain 5 consecutive X Windows 10 need help in counting the number of rows that contain 5 consecutive X Office 2016
Expert
 
Join Date: Apr 2014
Posts: 962
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

…or write your own user-defined function. See B6 in the attached.
=CountOfRowsWithNOrMoreConsecutiveXs(A1:G4,5)
(Case insensitive)
Code:
Function CountOfRowsWithNOrMoreConsecutiveXs(myRange, N)
Vals = myRange.Value
For rw = 1 To UBound(Vals)
  ThisRowCount = 0
  For colm = 1 To UBound(Vals, 2)
    If InStr(1, UCase(Vals(rw, colm)), "X") > 0 Then ThisRowCount = ThisRowCount + 1 Else ThisRowCount = 0
    If ThisRowCount >= N Then
      RowCount = RowCount + 1
      Exit For
    End If
  Next colm
Next rw
CountOfRowsWithNOrMoreConsecutiveXs = RowCount
End Function
Attached Files
File Type: xlsm msofficeforums40949file.xlsm (15.5 KB, 9 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
need help in counting the number of rows that contain 5 consecutive X how to copy different text from word into excel on consecutive rows mihnea96 Word VBA 4 05-08-2017 12:09 PM
Counting Consecutive Periods In Rows Using Numbers Yaaseen23 Excel 18 03-24-2017 11:15 AM
need help in counting the number of rows that contain 5 consecutive X Counting rows with a macro? Jennifer Murphy Word Tables 1 08-23-2016 03:00 PM
need help in counting the number of rows that contain 5 consecutive X Counting table rows in a page RavenSuzumiya Word Tables 1 06-09-2016 03:38 PM
need help in counting the number of rows that contain 5 consecutive X Problem with consecutive Figure number placements Ian A King Word 2 05-11-2015 10:13 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:04 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