Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to automate text formatting within numbers cells (using applescript?)

I lost the formatting of all the text in a column in a numbers spreadsheet.


Is there a way to format (in this case set bold) the first line of text within every cell in a column in numbers?


Each cell contains 2 or more lines of text seperated by a new line.

Posted on Dec 12, 2018 12:16 PM

Reply
Question marked as Best reply

Posted on Dec 13, 2018 7:45 PM

I thought it might be possible to do it with formulas and in the end I think it is but Numbers is very strange and inconsistent and buggy when it comes to text formats and formulas. After some trial and error here is a possible solution.


cell A1=CODE(10)

This is a line feed character. We want to search your strings for it but you cannot put that character directly into the FIND formula, you have to reference a cell that contains this character.


C2=LEFT(B2,FIND($A$1,B2))

D2=RIGHT(B2,LEN(B2)−LEN(C2))

E2=C2&D2


Then select column C and format it as bold. Hopefully it will result in what you see in my screenshot.


Now, to get it back into column B complete with the formatting, you have to do a roundtrip through TextEdit.

Select all the cells in column E

Copy

Open TextEdit

Paste

Manually select the columns of text (not including any additional line(s) TextEdit adds to the beginning and end)

Copy

Go back to Numbers

Paste into column B




For those wondering what I am finding inconsistent, here is an example

cell A1 has text all of which is formatted as bold

cell A2 has the formula =A1

The text is correct in A2 but the format does not carry over, it is regular text

But then put some regular text in cell A1 along with the bold text, now the formatting comes across to A2


There is also bugginess where formats might come over but, if you change the format, it no longer does. I can't remember exactly what I was doing to get this to happen but it was annoying.

6 replies
Question marked as Best reply

Dec 13, 2018 7:45 PM in response to rdyornot77

I thought it might be possible to do it with formulas and in the end I think it is but Numbers is very strange and inconsistent and buggy when it comes to text formats and formulas. After some trial and error here is a possible solution.


cell A1=CODE(10)

This is a line feed character. We want to search your strings for it but you cannot put that character directly into the FIND formula, you have to reference a cell that contains this character.


C2=LEFT(B2,FIND($A$1,B2))

D2=RIGHT(B2,LEN(B2)−LEN(C2))

E2=C2&D2


Then select column C and format it as bold. Hopefully it will result in what you see in my screenshot.


Now, to get it back into column B complete with the formatting, you have to do a roundtrip through TextEdit.

Select all the cells in column E

Copy

Open TextEdit

Paste

Manually select the columns of text (not including any additional line(s) TextEdit adds to the beginning and end)

Copy

Go back to Numbers

Paste into column B




For those wondering what I am finding inconsistent, here is an example

cell A1 has text all of which is formatted as bold

cell A2 has the formula =A1

The text is correct in A2 but the format does not carry over, it is regular text

But then put some regular text in cell A1 along with the bold text, now the formatting comes across to A2


There is also bugginess where formats might come over but, if you change the format, it no longer does. I can't remember exactly what I was doing to get this to happen but it was annoying.

How to automate text formatting within numbers cells (using applescript?)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.