+ Reply to Thread
Results 1 to 4 of 4

Concatenating together a series of IF statements to diplay a conditional list of numbers

  1. #1
    Registered User
    Join Date
    04-19-2012
    Location
    Hamilton, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    26

    Concatenating together a series of IF statements to diplay a conditional list of numbers

    Hi All

    I have a spreadsheet with the columns "criterion_1", "criterion_2" and criterion_3" with the row entry for each column being either "Yes", "No" or "Not Known".

    What I want is a formula which will give the criteria numbers which have been met (i.e. row entry "Yes") in a comma separated list.

    The formula I have written is

    Please Login or Register  to view this content.
    However with this formula if only one criterion is met then I get the number followed by a comma (i.e. 1,)

    How would I rewrite the formula so that I do not get a comma if only one criterion is met?

    See Attached spreadsheet.test.xlsx

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Concatenating together a series of IF statements to diplay a conditional list of numbe

    =SUBSTITUTE(TRIM(IF(B2="Yes",1,"")&" "&IF(C2="Yes",2,"")&" "&IF(D2="yes",3,""))," ",",")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    04-19-2012
    Location
    Hamilton, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Concatenating together a series of IF statements to diplay a conditional list of numbe

    Awesome!

    Thanks for that Martin.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Concatenating together a series of IF statements to diplay a conditional list of numbe

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    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
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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