Paragraphs in one Cell > HTML

goble

New Member
Joined
Oct 7, 2010
Messages
48
Office Version
  1. 2019
Platform
  1. Windows
Hello,

am trying to convert an excel file to HTML. I have a few 100s of rows.

Serial No.NameComposition
1Destadine SyrupEach ml contains:
Desratadine BP …….. 0.5 mg
In a flavoured syrup base
2ChlorphamineEach ml contains:
Frech BP …….. 0.5 mg
In a flavoured syrup base


In D2, I have : ="<tr><td>"&A2&"</td><td>"&B2&"</td><td>"&C2&"</td></tr>".
To keep the line break, I need to use the <br> tag. So final results should be : <tr><td>1</td><td>Destadine Syrup</td><td>Each ml contains:<br>Desloratadine BP …….. 0.5 mg<br>In a flavoured syrup base</td></tr>
Note
(i) that there is no <br> after syrup base.
(ii) the cell C3 contains a blank line at the end

Replacing "CTRL-J" by <br> (in the column which contains the above formula) would simply add <br> in every cells so the result will be :
<tr><td>1<br></td><td>Destadine Syrup<br></td><td>Each ml contains:<br>Desloratadine BP …….. 0.5 mg<br>In a flavoured syrup base<br></td></tr>

Thanks for any recommendation here..
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi, what version of Excel are you using?

I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Hi and thanks,

I have updated my account details.
 
Upvote 0
Thanks for that, how about
+Fluff 1.xlsm
ABCD
1
21 Destadine Syrup Each ml contains: Desratadine BP …….. 0.5 mg In a flavoured syrup base <tr><td>1</td><td>Destadine Syrup</td><td>Each ml contains:<br>Desratadine BP …….. 0.5 mg<br>In a flavoured syrup base</td></tr
32 Chlorphamine Each ml contains: Frech BP …….. 0.5 mg In a flavoured syrup base <tr><td>2</td><td>Chlorphamine</td><td>Each ml contains:<br>Frech BP …….. 0.5 mg<br>In a flavoured syrup base</td></tr
Master
Cell Formulas
RangeFormula
D2:D3D2="<tr><td>"&TEXTJOIN("</td><td>",,SUBSTITUTE(LEFT(A2:C2,LEN(A2:C2)-1),CHAR(10),"<br>"))&"</td></tr"
 
Upvote 0
Solution
Thanks for that, how about
+Fluff 1.xlsm
ABCD
1
21 Destadine Syrup Each ml contains: Desratadine BP …….. 0.5 mg In a flavoured syrup base <tr><td>1</td><td>Destadine Syrup</td><td>Each ml contains:<br>Desratadine BP …….. 0.5 mg<br>In a flavoured syrup base</td></tr
32 Chlorphamine Each ml contains: Frech BP …….. 0.5 mg In a flavoured syrup base <tr><td>2</td><td>Chlorphamine</td><td>Each ml contains:<br>Frech BP …….. 0.5 mg<br>In a flavoured syrup base</td></tr
Master
Cell Formulas
RangeFormula
D2:D3D2="<tr><td>"&TEXTJOIN("</td><td>",,SUBSTITUTE(LEFT(A2:C2,LEN(A2:C2)-1),CHAR(10),"<br>"))&"</td></tr"
Thanks for your input.

However am getting for D2 = #VALUE!
 

Attachments

  • Capture-excel-paragraph.PNG
    Capture-excel-paragraph.PNG
    29.7 KB · Views: 14
Upvote 0
You may need to confirm the formula with Ctrl Shift Enter, rather than just Enter.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,467
Members
452,516
Latest member
archcalx

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