Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to count a repeated number in number in particular range
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
I have a numbers 1,2,3,4.....98,99,100.
how to find how many times "1", or "2" number is present between 1 to 100 numbers
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
there could be an optimized way for this.
this is what i can have now, see the code below if it helps
Code:
msgbox RepeatedNumberCount(1,1000,"1")
Function RepeatedNumberCount(StartLimit,EndLimit,NumbertoSearch)
   RepeatedNumberCount = 0
   Dim sNum
    For Num = StartLimit to EndLimit
        sNum = cstr(Num)
        If instr(sNum,NumbertoSearch)  Then
            For n = 1 to Len(sNum)
                CurNum = Mid(sNum,n,1)
                If CurNum = NumbertoSearch Then nCount = nCount + 1
            Next
        End If
    Next
    RepeatedNumberCount = nCount
End Function

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  does WebTable Object provides a method to get column number umer830 4 12,906 07-06-2018, 09:32 AM
Last Post: vijaychourasiya0109@gmail.com
  Fetching total number of records inside a webtable vidya2k2 2 3,877 06-15-2015, 02:55 PM
Last Post: venkatesh9032
  Comapre txt file with different number of lines anushreebehura 0 1,741 06-02-2015, 06:28 PM
Last Post: anushreebehura
  How to make a function for an object that has a large number of parent objects Shroomsday 1 2,396 01-28-2014, 11:15 PM
Last Post: jacosta
  How to get center data value in a odd number of rows and columns web table ... sai rajesh 0 2,787 11-13-2013, 10:24 PM
Last Post: sai rajesh

Forum Jump:


Users browsing this thread: 2 Guest(s)