Text formula that inserts a text string in front of multiple choice questions

CatsIgnoreMe

New Member
Joined
Feb 8, 2016
Messages
15
I need to add two line break symbols (

) before each multiple choice. Values will range from a. to g.

Some questions might have a. , b. and c. while others might have all the way to g.
Below are before and after examples. Thank you for your assistance on this.

Current Value Example:
[TABLE="width: 899"]
<tbody>[TR]
[TD="class: xl63, width: 899"]How would you configure a profile to find duplicate records? a. read,edit b. view all c. merge d. delete

Same Value After Excel Formula is Applied:
How would you configure a profile to find duplicate records?

a. read,edit

b. view all

c. merge

d. delete
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Whoops! The question got mangled because I used HTML! Here's a screenshot of BEFORE the text formula and AFTER the text formula.

a0316kk.png
 
Upvote 0
Not sure I understand - see if this macro does what you want. First select all the cells you want to alter using your mouse, then run the macro. Test on a copy of your data.
Code:
Sub AddBreaks()
'select cells first, then run this macro
Dim c As Range, Where As Variant, i As Long, n As Long, S As String
Where = Array("a.", "b.", "c.", "d.", "e.", "f.", "g.")
Application.DisplayAlerts = False
For Each c In Selection
    S = c.Value
    For i = LBound(Where) To UBound(Where)
        n = InStr(S, Where(i))
        If n > 0 Then
            Mid(S, n - 1, 1) = Chr(10)
        End If
    Next i
    c.Value = S
    c.WrapText = True
    c.EntireRow.AutoFit
Next c
Application.DisplayAlerts = True
End Sub
 
Upvote 0
I will test tomorrow and give you an update. Initial super quick test looks good, but I also need to test more thoroughly.
VBA macros are over my head. Many thanks for the great response.
 
Upvote 0
JoeMo - The macro you kindly created works well in Excel, however, the reason behind my asking for the
Code:
<br><br>
is because I save the Excel file into CSV format, and then import the CSV file into Anki . The HTML
Code:
<br><br>
code is needed for Anki to create the line breaks.

CatsIgnoreMe
 
Upvote 0
JoeMo - The macro you kindly created works well in Excel, however, the reason behind my asking for the
Code:
is because I save the Excel file into CSV format, and then import the CSV file into Anki . The HTML
Code:
code is needed for Anki to create the line breaks.

CatsIgnoreMe
Sorry, Anki is unknown to me.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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