[Solved] Using Text Strings in Spreadsheet

Discuss the spreadsheet application
Post Reply
r-lawton
Posts: 12
Joined: Tue Jan 01, 2013 9:12 pm

[Solved] Using Text Strings in Spreadsheet

Post by r-lawton »

I'm trying to make a table to be completed by an elementary student. It would have numbers 1 - 10 in the top row and the first column. Each cell would have the format: "Number in top row", Operator (+,-,*,/), "Number in column", "=", space for result.
Example: "1+1=" where the kid fills in spaces up to "10+10=".
Row 1, Columns B-K are the numbers (as text) 1-10.
Column A, Rows 2-11 are the same.
Within each cell I need to concatenate the text strings from its row and column to compose the equation.
Cell B2 should read "1 + 1 =" with a space for the answer.
Cell K11 should read "10 + 10 ="
Cell C4 should read "2 + 3 =", etc.

Once I know how to concatenate text strings within spreadsheet cells, the rest is easy.

TIA for any help. I'm helping home school my nephew and he needs the math practice.
Last edited by MrProgrammer on Fri Dec 04, 2020 2:46 am, edited 1 time in total.
Reason: Tagged ✓ [Solved]
OpenOffice 3.3, Windows XP Pro
User avatar
robleyd
Moderator
Posts: 5082
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Using Text Strings in Spreadsheet

Post by robleyd »

There are at least two ways - one is the CONCATENATE() function

Code: Select all

CONCATENATE("Text1"; "Text2"; ...)
Or the concatenation operator, ampersand possibly in conjunction with the TEXT() function

Code: Select all

="foo" &" bar"
=A1 & B1
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
User avatar
robleyd
Moderator
Posts: 5082
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Using Text Strings in Spreadsheet

Post by robleyd »

A problem you are going to come across here is that if, for example your cell B2 looks like

Code: Select all

=B1&"+"&A2&"= "
it will display as "1+1= " (without the quotes) but the formula will be overwritten as soon as the user tries to enter the answer 2 - I suspect this may not be what you want.

You might consider re-designing the sheet so the cells containing the problem have an empty answer cell adjacent.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
User avatar
MrProgrammer
Moderator
Posts: 4906
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Using Text Strings in Spreadsheet

Post by MrProgrammer »

r-lawton wrote:Within each cell I need to concatenate the text strings from its row and column to compose the equation.
You will want to understand how relative references work in a spreadsheet. Read section 8. Using formulas and cell references in Ten concepts that every Calc user should know. The formula shown there is very close to what you need but it performs the addition. However, you can change it to contatenate the numbers and display the equation instead. You can use the CONCATENATE function or the & operator.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Post Reply