+ Reply to Thread
Results 1 to 2 of 2

Series Trending

  1. #1
    Bill
    Guest

    Series Trending

    Hello,
    I want to know, in a series of numbers, the number of points trending in one
    direction (up or down). If I reach a certain number, e.g., 7, I want to
    kick out of the routine. I can do this by looping through the cells and
    adding up as I go, e.g.

    upcounter = 0
    for icount = 1 to lastrow
    if cells(icount+1,1)>cells(icount,1) then
    upcounter = upcounter+1
    else
    upcounter = 0
    end if
    if upcounter = 7 then goto 100
    next icount


    100 otherstuff

    This takes a while with big data sets. Is there a way to use arrays to do
    this? Or some other way?

    Thanks in advance.

    Bill



  2. #2
    Tom Ogilvy
    Guest

    Re: Series Trending

    Dim v as Variant
    upcounter = 0
    v = Range("A1").Resize(lastRow,1).Value
    for icount = 1 to lastrow
    if v(icount+1,1)>v(icount,1) then
    upcounter = upcounter+1
    else
    upcounter = 0
    end if
    if upcounter = 7 then goto 100
    next icount


    --
    Regards,
    Tom Ogilvy


    "Bill" <bill@bpiconsulting.com> wrote in message
    news:7_Hkf.9230$N45.8602@newsread1.news.atl.earthlink.net...
    > Hello,
    > I want to know, in a series of numbers, the number of points trending in

    one
    > direction (up or down). If I reach a certain number, e.g., 7, I want to
    > kick out of the routine. I can do this by looping through the cells and
    > adding up as I go, e.g.
    >
    > upcounter = 0
    > for icount = 1 to lastrow
    > if cells(icount+1,1)>cells(icount,1) then
    > upcounter = upcounter+1
    > else
    > upcounter = 0
    > end if
    > if upcounter = 7 then goto 100
    > next icount
    >
    >
    > 100 otherstuff
    >
    > This takes a while with big data sets. Is there a way to use arrays to do
    > this? Or some other way?
    >
    > Thanks in advance.
    >
    > Bill
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1