concat

zoharb

Board Regular
Joined
Nov 24, 2011
Messages
85
Office Version
  1. 2021
  2. 2013
201420152016201720182019
aug579111315
sep91012151719
oct131315192123
nov171618232527
dec211921272931
jan252729313335
3531
jan 2019dec 2019jan 2017


want to get multiple results as in D61 in horizontal
 

Attachments

  • concat.jpg
    concat.jpg
    27.8 KB · Views: 33
you could use this code and run this macro in the cell below the lookup value. Adjust your range and settings to suit.
VBA Code:
Sub multijoiner()
Dim rng As Range
Dim A As String
Dim B As Integer, I As Integer, C As Integer

Set rng = Range("A1:G7") ' Adjust as required
A = ""
B = ActiveCell.Offset(-1, 0).Value
C = Application.WorksheetFunction.CountIfs(rng, B)
If C = 0 Then
    ActiveCell = "Not found"
    Set rng = Nothing
    Exit Sub
    Else
End If
For Each Cell In rng
    If Cell.Value = B Then
        A = A & Cells(Cell.Row(), 1).Value & " " & Cells(1, Cell.Column()).Value
        Else
    End If
Next
ActiveCell = A
Set rng = Nothing
End Sub
 
Upvote 0
When using XL2BB it is normally best to use 'Mini Sheet' instead of 'Table Only' so we can see just where your data is. For example, in post 1 you referred to cell D61 but we have no idea from your XL2BB (or image) what is in that cell.

Something like this perhaps?
Column J if you want to copy the formula down or column K if you want a single formula to spill all the results.

25 04 01.xlsm
ABCDEFGHIJK
120142015201620172018201935jan 2019jan 2019
2aug57911131531dec 2019, jan 2017dec 2019, jan 2017
3sep91012151719
4oct131315192123
5nov171618232527
6dec211921272931
7jan252729313335
zoharb
Cell Formulas
RangeFormula
K1:K2K1=MAP(I1:I2,LAMBDA(r,TEXTJOIN(", ",1,IF(B2:G7=r,A2:A7&" "&B1:G1,""))))
J1:J2J1=TEXTJOIN(", ",1,IF(B$2:G$7=I1,A$2:A$7&" "&B$1:G$1,""))
Dynamic array formulas.
 
Upvote 0
1apr25-invoice-all clients-Sep23.xlsm
ABCDEFGHIJKL
1201420152016201720182019
2aug57911131527nov 2019dec 2017jan 2015
3sep9101215171927nov 2019, dec 2017, jan 2015
4oct131315192123output @now
5nov17161823252727Nov-19output needed
6dec211921272931Dec-17
7jan252729313335Jan-15
Sheet2
Cell Formulas
RangeFormula
I2I2=CONCAT((IF(H2=B2:G7,A2:A7&" "&B1:G1,"")))
I3I3=TEXTJOIN(", ",1,IF(B$2:G$7=H3,A$2:A$7&" "&B$1:G$1,""))

Respected ,
I need output of each data in a different row. this is needed as we have space constraints in the place where I want to apply
 
Upvote 0
I need output of each data in a different row.
Good idea to tell/show us that at the start? ;)

Here is one way.
25 04 01.xlsm
ABCDEFGHI
1201420152016201720182019
2aug579111315
3sep91012151719
4oct131315192123
5nov17161823252727Nov-19
6dec211921272931Dec-17
7jan252729313335Jan-15
zoharb (2)
Cell Formulas
RangeFormula
I5:I7I5=FILTERXML("<p><c>"&TEXTJOIN("</c><c>",1,IF(B2:G7=H5,A2:A7&"-"&B1:G1,""))&"</c></p>","//c")
Dynamic array formulas.
 
Upvote 0
I've tried to solve this with the FILTER function and ran into an error which I can't explain.

MrExcel_2025-03.xlsm
ABCDEFG
1201420152016201720182019
2aug579111315
3sep91012151719
4oct131315192123
5nov171618232527
6dec211921272931
7jan252729313335
83531
9#VALUE!
013
Cell Formulas
RangeFormula
C9C9=FILTER(B2:G7,B2:G7=C8,"")


Why is this throwing the #VALUE! error? As far as I understood the function syntax it shouldn't happen. What am I missing?

EDIT: Changing the references from relative to absolute doesn't work either. In any way.
 
Upvote 0
Why is this throwing the #VALUE! error?
It looks like you are trying to treat the 6 x 6 array of cells as if it were a 1 column x 36 rows array. Filtering the array B2:G7 would always return an array containing 6 columns.

I'm not exactly sure what you were trying to do with that formula as it has nothing to so with column A or row 1 that the OP wants, but with 365 (but not 2021 that the OP has) you could do something like ..
=LET(d,TOCOL(B2:G7),FILTER(d,d=C8,""))
.. but all that would do is return the C8 value repeated as many times as that value occurs in the given range.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top