+ Reply to Thread
Results 1 to 6 of 6

Count from one .

  1. #1
    Forum Contributor
    Join Date
    12-12-2017
    Location
    New Zealand
    MS-Off Ver
    Ms Office 2016
    Posts
    447

    Wink Count from one .

    Hello all ,

    I am wanting to get the results I have in col M . A macro would be great . But willing to start with a function .

    These results look at col L and sees how many times a number appears
    and counts down col from one until a different number appears then count starts again .

    This is all very random .

    There may be up to 20 or more of each number , then next could on be one only .

    Thanks .
    Attached Files Attached Files
    I am grateful for all answers to my questions .
    Also i give a reputation even if not answered .

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Count from one .

    In M2, copied down:
    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Count from one .

    It looks like the goal is to simply count how many consecutive times n appears in Tab#. You also seem to prefer a macro, but I wonder why. Here's how I would do it with a simple worksheet formula:
    In M2 enter 1
    In M3 enter =IF(L3=L2,M2+1,1) and copy down as far as needed.

    If I decided that I really preferred VBA, then it would be the same thing but in a VBA loop. (pseudocode)
    Please Login or Register  to view this content.
    Personally I prefer the spreadsheet function programming language for something like this, but the VBA language works fine, too.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Contributor
    Join Date
    12-12-2017
    Location
    New Zealand
    MS-Off Ver
    Ms Office 2016
    Posts
    447

    Re: Count from one .

    Thanks to you both , functions great . A macro is quicker on larger sheets and i dont have to send to values etc , less work as such .
    But what is provided works perfect . Thanks again .

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Count from one .

    Here is another formula that could be used in cell M2 and copied down...

    =COUNTIF(L$2:L2,L2)

  6. #6
    Forum Contributor
    Join Date
    12-12-2017
    Location
    New Zealand
    MS-Off Ver
    Ms Office 2016
    Posts
    447

    Re: Count from one .

    Thanks Rick , can also use this . Thank you .

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 03-03-2018, 05:00 AM
  2. Replies: 1
    Last Post: 05-19-2017, 07:37 AM
  3. Replies: 17
    Last Post: 04-11-2016, 11:14 PM
  4. Macro count items in sheet2 and provide count in embedded label in sheet1
    By jaredmccullough in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-05-2015, 11:27 AM
  5. [SOLVED] for every line I browse make a count and post this count in a cell (fiouuu)
    By historic777 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2013, 06:41 AM
  6. Range.columns.count property returns wrong count after union operation
    By gopinan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2008, 04:48 AM

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