+ Reply to Thread
Results 1 to 4 of 4

formula or function to return a string of numbers based on a counter

  1. #1
    Registered User
    Join Date
    04-08-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    57

    formula or function to return a string of numbers based on a counter

    I have a workbook that has a counter button. When data is entered in a particular column, the counter value is recorded. This data is used to fill in a formula for a specified number of "counts" (button clicks). The number of counts varies depending on the data entered and is supplied from a table using the VLOOKUP function.

    What I would like to do is record a list of "counts" that the data will be used in a single cell.

    For example, say the data "CAT" is entered in the designated column and the counter reads a value of "5" VLOOKUP function returns the specified values for "CAT" found in a separate table, including a duration value of "3" counts. (So far I have this working) Based on this data, I would like to be able to populate a single cell that would have a value of "5, 6, 7".
    The idea I have is I would then be able to use COUNTIF or some other function to look for the "count" value in this cell and run the calculations each time the count value is found. (Haven't gotten this far yet).

    It's difficult to describe exactly what I'm trying to do so I've attached an example. Thanks!
    Attached Files Attached Files

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

    Re: formula or function to return a string of numbers based on a counter

    What does "...the data "CAT" is entered in the designated column..." mean? Are you saying that the list starting in C9 is growing, and therefore the table in H9:M12, also? Do the numbers starting in B9 come from the counter? Is the max duration (from sheet 3) always 6?
    Last edited by protonLeah; 04-09-2017 at 07:36 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-08-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: formula or function to return a string of numbers based on a counter

    Sorry, I'll try to explain better...

    The data in column C is entered by the user, "CAT", "DOG", etc, so yes this list would continue to grow. I made the attached example as a simple model of what I'm trying to do. The data table in my working project is much larger and contains more variables.

    Yes, the numbers starting in B9 come from the counter. Any entry in column C will populate the counter value into column B. If you were to click the "Turn" button until the counter read "20" and enter anything in column C, column B of the same row would be populated with "20".

    No, in the real version of this project, the duration value has a range from 1 to 100.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,670

    Re: formula or function to return a string of numbers based on a counter

    If I understand correctly and if you are willing at this point to use a 'low tech' solution, here goes.
    This solution employs numerous helper columns, which could be moved/hidden for aesthetic purposes, however only four fairly simple formulas.
    The formula that populates helper columns V:AE is: =IF(COUNT($U9:U9)<$H9,$B9+1*(COLUMN(A1)-1),"")
    The formula that populates helper column AF is: =V9&IF(W9<>"",", "&W9,"")
    The formula that populates helper columns AG:AN is: =AF9&IF(X9<>"",", "&X9,"")
    The formula that populates column L is: =AN9
    Since the real version has a duration value of 100 that means that 199 columns would need to be set aside for helpers, however the number of formulas remains the same -- there are 16,384 columns available.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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: 7
    Last Post: 03-30-2015, 11:34 AM
  2. Possible feature - increment counter based on string pattern ?
    By davidku in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2014, 04:08 PM
  3. [SOLVED] user defined function to return a string value based on two column matches
    By Ed C in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2012, 11:02 AM
  4. Return the string between two character numbers
    By rhua5436 in forum Excel General
    Replies: 3
    Last Post: 09-30-2011, 01:25 AM
  5. Return a list of names based on IF function formula
    By PRodgers4284 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-22-2009, 08:48 AM
  6. [SOLVED] Return a digit in a string of numbers
    By W M in forum Excel General
    Replies: 5
    Last Post: 05-11-2005, 02:06 PM

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