+ Reply to Thread
Results 1 to 11 of 11

Repeating items a specific number of times

  1. #1
    Registered User
    Join Date
    01-22-2008
    Posts
    38

    Repeating items a specific number of times

    Hello,

    I am trying to create a formula that would provide a result a specific number of times based on a table in a seperate worksheet. Here is an example:

    Person: # of times
    John 2
    Joe 2
    Frank 2
    Jack 1

    Based on an IF statement, the cell should bring back John, the next cell down should bring back John, the third cell should bring back Joe as John has reached his limit of 2, and have this repeat until all criteria that meet the IF statement have been met.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Well it's not the prettiest way but, here's one anyways...

    First you need to download and install the morefunc.xll addin from this free website: http://xcell05.free.fr/english/

    then put this formula in any cell, I will assume you put it in E1 and your original data is in A1:B4

    Please Login or Register  to view this content.
    after adjusting the ranges, you must confirm this formula with CTRL+SHIFT+ENTER keys...not just ENTER...you will notice { } brackets appear around the formula

    that formula will concatenate all the names, including repeats, all in one cell.

    Then in another cell, say F1.... apply this formula:

    Please Login or Register  to view this content.
    again, where E1 is the location of the Mconcat formula....

    then copy down.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    01-22-2008
    Posts
    38
    Thanks NBVC....

    This seems to be working, however, maybe you can help with the next step. How would I be able to take a list of products, for example, and have each of them assigned to the individuals based on the number of times previously determined. For example

    Apple - John
    Orange - Jane
    Peach - Hebert
    Apple - John
    Apple - John
    Orange - Jane
    Apple - Jack (since john has reached his limit of 3)
    Orange - Janis (since jane has reached her limit of 2)

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by ninja0059
    Thanks NBVC....

    This seems to be working, however, maybe you can help with the next step. How would I be able to take a list of products, for example, and have each of them assigned to the individuals based on the number of times previously determined. For example

    Apple - John
    Orange - Jane
    Peach - Hebert
    Apple - John
    Apple - John
    Orange - Jane
    Apple - Jack (since john has reached his limit of 3)
    Orange - Janis (since jane has reached her limit of 2)

    Not sure I understand.... please post a zipped Xl2003 workbook showing what you need to be done.

  5. #5
    Registered User
    Join Date
    01-22-2008
    Posts
    38
    Here is a sample:
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    See the attached...

    I basically used the same concept I described about to get the items you see in columns I:K (these rows can be hidden).... make sure that you copy the formulas in J and K down as far as necessary to ensure all your data from E to G is covered.

    Formula in I1:
    Please Login or Register  to view this content.
    Formula in I2:
    Please Login or Register  to view this content.
    both CSE confirmed

    Formula in J1, copied down as far as you want:
    Please Login or Register  to view this content.
    Formula in K1, copied down as far as you want:

    Please Login or Register  to view this content.
    Then In B2, to extract your desired values, I inserted formula:
    Please Login or Register  to view this content.
    which must be confirmed with CTRL+SHIFT+ENTER and then copied down.

    adjust all ranges to suit and re-confirm with CSE keys where necessary.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-22-2008
    Posts
    38
    NBVC - The CTRL + SHIFT + ENTER is not working for me. Is there a setting I have to change to make this work?

  8. #8
    Forum Contributor snasui's Avatar
    Join Date
    07-15-2007
    Location
    Songkhla, Thailand
    MS-Off Ver
    2010, 365
    Posts
    167
    Quote Originally Posted by ninja0059
    Here is a sample:
    Another,

    See attathed file.

    Hope this helps.

    ------
    snasui
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    01-22-2008
    Posts
    38
    Thanks for the additional sheet. However, my CTRL + SHIFT + ENTER still does not allow the formula to include the { } in it. In essence, the formula is now working, but stops after the first row.

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    In order for you to get the { } around the formula, the formula in the cell must be "activated".... so click the cell with the formula and hit F2 so the cursor shows in the formula. Then hold the Ctrl and Shift keys down and hit Enter..

  11. #11
    Registered User
    Join Date
    01-22-2008
    Posts
    38
    That worked.....THANKS

    P.S. I am sure I will have an additional question, but THANK YOU for now

+ 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