it's not exactly transposing (that was my first thought)

and the transpose formula is built in to both excel and libreoffice (no need for an addin)

FWIW here's a bit of VBA I found on the web that does what you want, though the output is to a delimited string (pretty sure you can work it out from there)

Function MYVLOOKUP(lookupval, lookuprange As Range, indexcol As Long)

Dim r As Range

Dim result As String

result = ""

For Each r In lookuprange

If r = lookupval Then

result = result & "," & r.Offset(0, indexcol - 1)

End If

Next r

MYVLOOKUP = Right(result, Len(result) - 1)

End Function

paste it into your (excel) personal macro workbook, then call it as a user defined function from the FX dialog box (syntax is the same as a normal VLOOKUP)

Working with excel row and columnscredit for the code goes here -

http://www.mrexcel.c...ell-concatenate.html