Excel: How to use an Array to concatenate strings that are next to a criteread section (If function)

后端 未结 3 1669
旧时难觅i
旧时难觅i 2021-01-17 03:51

Good Day Everyone

I have an Excel sheet as bellow in two columns. I know how to use an array if function with sum to add up all values next to a column that has met

相关标签:
3条回答
  • 2021-01-17 04:19

    If I'm assuming you don't want the relatively easy VBA solution where you recurse through the initial list and concatenate the answers then you could put the following into B8:

    =IFERROR(INDEX(Sheet1!$A$1:$A$6,SMALL(IF(Sheet1!$B$1:$B$6=$A8,ROW(Sheet1!$B$1:$B$6)-ROW(Sheet1!$B$1)+1),COLUMNS($B1:B1))),"")

    You'd have to drag it across as it'll put them in separate columns but then you should be able to concatenate them into a single column afterwards.

    You have to have Ctrl and Shift held down when inputting as it's an array formula.

    0 讨论(0)
  • 2021-01-17 04:21
    • Activate iteration in the options. The maximum number of iterations must be equal to or greater than the number of lines.
    • Add =IF(D1=100;1;D1+1) to cell D1
    • This is the formula in cell E1 for the Stark houses: =IF(D1=1;"";IF(D1-1>COUNTIF(B:B;"Stark");E1;E1&INDEX(A$1:A$100;SMALL(IF(B$1:B$100="Stark";ROW($1:$100));D1-1))))

    (I hope that I got the English names of the functions correctly.)

    I missed one information: You must enter the function as an array function.

    Thanks go to http://www.excelformeln.de/formeln.html?welcher=155

    0 讨论(0)
  • 2021-01-17 04:25

    Was really Strugling to get it right and eventualy got an answer from a stackoverflow question on how to concatenate whole columns.

    Sorted the data via B and then used =TRANSPOSE(A4:A6)

    Then Used F9 on the function to get this line ={"Mansion1","Mansion 2","House 3"}

    Copied and Concatenate and just remove the {

    But this was not ideal as the data set I want to use this on is 2500+ lines :( Manualy did it though :( :( but will try the above answers for future use.

    0 讨论(0)
提交回复
热议问题