Note:
in June 2017, Microsoft disabled the use of JavaScript in a Calculated Column
That means given answers may not apply for newer SharePoint versions
For long explanation and work arounds see:
June 13th 2017 Microsoft blocked handling HTML markup in SharePoint calculated fields - how to get the same functionality back
Original answer:
This works in VIEWS on SP2010,13,16 & Online, and does not require jQuery or any extra JavaScript files or (Content Editor) WebParts
Disclaimer: you need minor JavaScript skills (just to understand what you are copy pasting), and debugging this code is PITA
The Lookup info you are after is actually available in the Context object once the VIEW has loaded, so you can access it with either CSR (Client side Rendering) or....
Stuff some Javascript in a Calculated Column... less lines compared to CSR.. but difficult to debug if you don't get the syntax right.
instructions
On the View page, Open F12 console and check the exact spelling for your Lookup Column (internal fieldname) in: ctx.ListData.Row[0]
(paste this Array reference and hit enter, it will display the value for the first displayed List-Item)
Then create a Calculated Column, set the datatype to Number so it executes the HTML!
(You only want this on the List, if you have ContentTypes, do NOT add this Column to ContentTypes)
Formula:
="<div style=""text-align:left""><img src=""/_layouts/images/blank.gif"" onload=""{"
&"var TR=this;while(TR.tagName!='TR'){TR=TR.parentNode}"
&"var item=ctx.ListData.Row[TR.rowIndex-1];"
&"this.parentNode.innerHTML=item['Title'].replace(/;/g,'<br>');"
&"}""></div>"
replace Title with the internal fieldname of your Column (The internal name is the name of the Column when you first created it)
explanation
- The onload function is triggered once the blank image is loaded.
- The Table Row has the rowIndex.. but the first table row in the View Table is the Header row so we have to subtract -1
- at the end the whole IMG tag is overwritten with the Lookup string replacing ; with BR tags
Detailed explanation and Pros & Cons at www.ViewMaster365.com/#How
iCC