+ Reply to Thread
Results 1 to 21 of 21

stack words based on freq

  1. #1
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Unhappy Group words from number list

    hi excelers,
    I have being trying to create a formula that could list words from singles, doubles, triples, numbers... example below:

    Book1.xlsx

    as you can see from the attachment the formula must locate the freq number, and then make refer to the "word".
    hope this is possible and than I explained this clearly, if not please post... thanks stew
    Last edited by Stews; 04-10-2013 at 06:56 AM.

  2. #2
    Forum Contributor
    Join Date
    01-07-2013
    Location
    south africa
    MS-Off Ver
    Excel 2003-13
    Posts
    210

    Re: Group words from number list

    Hello
    Do you mind a bit of VBA, I can't find a suitable Excel function to increment a counter

    Regards

  3. #3
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: Group words from number list

    not big on using VBA... but thanks for your time, hamjam

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Group words from number list

    See if this does as you need.

    Note that the formula in K2 is a CSE array.
    It must be confirmed with Ctrl+Shift+Enter, not just Enter, before dragging accross then down.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: Group words from number list

    Marcol, thanks that seem to work well... I'm gratful for you time and help.

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: stack words

    I can't tell from your file, what's your given data and what's your results? Is A1:B3 given and you want to fill in the values in A6:B12? Or is it the opposite? Or something else?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: stack words

    yes result in A1:B10

    and data below. thanks

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: stack words

    Assuming there's the possiblity of ties, I first created a helper column in C11 (in my slightly modified sheet)
    =IF(ISNUMBER(A11),A11&"_"&COUNTIF($A$11:A11,A11),"")
    This gives each value a unique ID

    Then in A2
    =IFERROR(LARGE($A$11:$A$17,ROW(A1)),"") copied down

    Then in B2 copied down
    =IFERROR(INDEX($B$11:$B$17, MATCH(A2&"_"&COUNTIF($A$2:A2,A2),$C$11:$C$17,0)),"")
    See attachment
    Questions?
    Attached Files Attached Files

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: stack words based on freq

    You'll need some form of VBA to do this.

    Excel 2011 is a Mac version, right? Does it support VBA?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  10. #10
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: stack words based on freq

    Hello,

    Not sure if I understand your problem, but you can try the Array formula in this sample file
    Show words.xlsx
    If you change the cell before any of the word in the list (From A8 to A13) to 1 or -, the list will automatically update.
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: stack words based on freq

    I think they want the results to appear in a single cell.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: stack words based on freq

    Here's a tip you might find useful...

    Using the ROW() function makes the formula specific to the row(s) it's entered on and makes it vulnerable to new row insertions before the referenced range.

    Insert a new row 1 and see what results your formula generates.

    You can make the formula more robust by using the ROWS(...) function instead and, it doesn't make the formula overly complex or inefficient.

    Here's how I would write that formula:

    =IF(ROWS(A$1:A1)>COUNTIF(A$8:A$13,1),"",INDEX(B:B,SMALL(IF(A$8:A$13=1,ROW(A$8:A$13)),ROWS(A$1:A1))))

    Insert a new row 1 and see the difference.

  13. #13
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: stack words based on freq

    thanks tony & Lemice, I have attached the sheet below.

    I though there would be a more simpler solution!
    Attached Files Attached Files

  14. #14
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: stack words based on freq

    Is this what you are looking for?
    Book1.xlsx
    Just put 1 somewhere or delete 1 somewhere, and you will see the list changing on itself

  15. #15
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: stack words based on freq

    thanks Lemice, wow its works!
    is it possible to also add 2 or 3 or 4 etc in the formula.

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: stack words based on freq

    Quote Originally Posted by Stews View Post
    I have attached the sheet below.
    OK, you have the correct formula entered in cell A1 but you have to enter it as an array formula.

    Array formulas are entered differently than a regular formula.
    After you type in a regular formula you hit the ENTER key.
    With an array formula you *must* use a combination of keys.
    Those keys are the CTRL key, the SHIFT key and the ENTER key.
    That is, hold down both the CTRL key and the SHIFT key then
    hit the ENTER key.

    When done properly Excel will enclose the formula in squiggly
    brackets { }. You can't just type these brackets in, you
    *must* use the key combo to produce them. Also, anytime
    you edit an array formula it *must* be re-entered as an
    array using the key combo.

    So, array enter the formula then drag copy down until you get blanks.

  17. #17
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: stack words based on freq

    Quote Originally Posted by Stews View Post
    is it possible to also add 2 or 3 or 4 etc in the formula.
    Not sure what you mean. Do you mean you want to extract the data that corresponds to 1 OR 2 OR 3 OR 4...

    1...A
    5...X
    4...T
    7...R
    2...W

    Result would be:

    A
    T
    W

    Is that what you want?

  18. #18
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: stack words

    thanks ChemistB,
    Wow your formula works, but is it possible to get it to list doubles or 3s or 4s! (each columa)
    if this is possible it would readly help.

    again thanks for your time.

  19. #19
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: stack words

    I'm not sure what you want. Isnt' the number in Column A refer to the amount of each word. Can you upload an example EXCEL file with what you have and what you want (Go Advanced> Manage Attachments)?

  20. #20
    Registered User
    Join Date
    11-18-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2011
    Posts
    54

    Re: stack words

    Hi, I mean stack the words together from a list with words and spaces.

    see attachment, thanks
    Attached Files Attached Files

  21. #21
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: stack words

    Hmmm, the file you uploaded doesn't have any of the numbers that you had in post 1 and doesn't help at all with this in Post 5
    is it possible to get it to list doubles or 3s or 4s! (each columa)
    This Array equation in B2 stacks all items below, even if they have no number next to them.

    =IFERROR(INDEX($B$11:$B$17, MATCH(A2&"_"&COUNTIF($A$2:A2,A2),$C$11:$C$17,0)),IFERROR(INDEX($B$11:$B$17,SMALL(IF($A$11:$A$17="",ROW($A$11:$A$17)-ROW($A$11)+1,10000),ROW(A1)-COUNT($A$11:$A$17))),""))
    See attached.
    Attached Files Attached Files

+ 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