You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

How to create "Madlib" text variables in Pages?

What's the best way to create a very simple "Madlib" type text variable with Pages for MacOS?


Pages has the ability to create tables & cells internally without needing to use a numbers document. What I would like to do is simply use one of the internal tables to enter text into the cells (ex: Noun, Adjective, Type of bird, Type of Car, etc). Lets call that the Key Table.


Below that, I'd like to have a body of text containing 'text variables' (placeholder text?), which would each refer to the text in a specific cell. This way, the body of text would always be updated based on what was in the key table.


Is there a way to do this in Pages (placeholder text? Equations?)? I am scrubbing the user manual and cannot find a way of doing this.



Posted on Nov 24, 2019 5:25 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 26, 2019 11:32 PM

What you are referring to as "placeholder text" might more accurately be termed a "merge field", which takes data from a a specific row ('record') and column ('field') of a data table and uses it to fill the field.


Current versions of Pages (after Pages '09/Pages 4.x) do not support 'mail merge'.


You might be able to create a reasonable facsimile using two tables; one on which you enter words of the specified types, then other containing cells filled with fixed text concatenate with cell references that retrieve the entered text from the first table.


Here's a quick and simple example.


At the start:

Table 1 appears empty.


Table 2, (on a separate Sheet) contains a list of word types in column A, and empty cells in column B.


The user fills the cells in column B with words of the type specified in column A. Note that Table 1 remains empty until…


The user presses return to complete the entry in the last cell. ("Last" refers to time of entry. Any of the cells in column B can be the 'last'.) When all cells in column B are filled, the 'mad lib' appears in Table 1, andthe user can click on the Sheet 1 tab to view the result.




IF(COUNTA(Table 2::B)<6,"","The "&Table 2::B1&" "&Table 2::B3&" "&Table 2::B5&" "&Table 2::B6&" the "&Table 2::B2 &" "&Table 2::B4&".")



The first part: IF(COUNTA(Table 2::B)<6,"",


Counts the number of cells in column B of Table 2 that have an entry. If that number is less than 6, IF places a null string ( "" ) in the cell, which makes it appear 'blank'.


If the count is 6, IF calls the rest of the formula:

"The "&Table 2::B1&" "&Table 2::B3&" "&Table 2::B5&" "&Table 2::B6&" the "&Table 2::B2 &" "&Table 2::B4&"."


The ampersand here is the concatenation operator, which joins stings of text together. In this case, the text is words ("The". spaces ( " " ), the content of each cell named in the formula, and a closing period ( "." ).


Regards,

Barry

2 replies
Question marked as Top-ranking reply

Nov 26, 2019 11:32 PM in response to jedoralive

What you are referring to as "placeholder text" might more accurately be termed a "merge field", which takes data from a a specific row ('record') and column ('field') of a data table and uses it to fill the field.


Current versions of Pages (after Pages '09/Pages 4.x) do not support 'mail merge'.


You might be able to create a reasonable facsimile using two tables; one on which you enter words of the specified types, then other containing cells filled with fixed text concatenate with cell references that retrieve the entered text from the first table.


Here's a quick and simple example.


At the start:

Table 1 appears empty.


Table 2, (on a separate Sheet) contains a list of word types in column A, and empty cells in column B.


The user fills the cells in column B with words of the type specified in column A. Note that Table 1 remains empty until…


The user presses return to complete the entry in the last cell. ("Last" refers to time of entry. Any of the cells in column B can be the 'last'.) When all cells in column B are filled, the 'mad lib' appears in Table 1, andthe user can click on the Sheet 1 tab to view the result.




IF(COUNTA(Table 2::B)<6,"","The "&Table 2::B1&" "&Table 2::B3&" "&Table 2::B5&" "&Table 2::B6&" the "&Table 2::B2 &" "&Table 2::B4&".")



The first part: IF(COUNTA(Table 2::B)<6,"",


Counts the number of cells in column B of Table 2 that have an entry. If that number is less than 6, IF places a null string ( "" ) in the cell, which makes it appear 'blank'.


If the count is 6, IF calls the rest of the formula:

"The "&Table 2::B1&" "&Table 2::B3&" "&Table 2::B5&" "&Table 2::B6&" the "&Table 2::B2 &" "&Table 2::B4&"."


The ampersand here is the concatenation operator, which joins stings of text together. In this case, the text is words ("The". spaces ( " " ), the content of each cell named in the formula, and a closing period ( "." ).


Regards,

Barry

How to create "Madlib" text variables in Pages?

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