Use Formula inside text sentence?

foofdawg

New Member
Joined
Aug 2, 2007
Messages
1
Windows XP: Excel 2002

I am trying to insert a cell reference inside a cell that has a sentence in it.

Example: Cell A1 contains the value "27".
Cell A2 contains the sentence "I am X years old", and I want X to equal the value in Cell A1.

After using the concatenate function many times to combine data from different columns with first names, middle names, and last names, that results in appropriate spacing, I know that I can use the following formula to obtain a full name in one cell, with appropriate spacing.

=concatenate(a1," ",b1," ",c1)

That will give me the contents of cell a1, then a space, then cell b1, then a space, and then cell c1, all in one column (the full name column, in my case).

For my current problem, I've tried things such as

="I am",A1,"years old"

but it doesn't seem to work.

I know I could get around this by putting the first part of the sentence in one cell, and the second half in another cell, and then just reference the 3 cells to get this to work, but then I end up with 2 cells on the spreadsheet that might appear erroneous to my clients, or interfere later on (unless I place them on line 65530 or something, but if you print without making a print area selection, you'll get all those thousands of rows in between as blank pages.

Currently, I get around this by having a cell that says "I am this many years old" and then the next cell has the value, but this is pathetic looking.

Any ideas on how to get a formula to work inside of plain text?

BTW, I did read through the mrexcel articles, and searched the forum, but had no luck finding the answer.

It's sometimes difficult to search for things regarding excel and other computer functions when you don't know the proper terminology. (Searching for "formulas inside text" yielded no results).
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I registered literally just to thank you for this seamingly easy formula that took me FOREVER TO FIND!! For reference (for someone in the future possibly needing a formula like this), I needed it to create a shortcode for WordPress to add URL references within the shortcode.

The Shortcode I needed to create was [jw source="URL" mediaid="########" poster="URL"]

I had the source url, media id and poster URL in 3 different columns which I wanted to use to create a shortcode for (I have 1000+ videos I needed to create a shortcode for)

Here's my adapted formula to make this work for my purpose:
Code:
=[/FONT][/COLOR][COLOR=green][FONT=Inconsolata]"[jw source='"[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#F7981D][FONT=Inconsolata]B2[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=green][FONT=Inconsolata]"' mediaid='"[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#7E3794][FONT=Inconsolata]C2[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=green][FONT=Inconsolata]"' poster='"[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#11A9CC][FONT=Inconsolata]D2[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=green][FONT=Inconsolata]"']"[COLOR=#000000]


[/COLOR]WORKED PERFECTLY! THANK YOU Makrini!
 
Upvote 0
Woops it messed up my formula:

="[jw source='"[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#F7981D][FONT=Inconsolata]B2[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=green][FONT=Inconsolata]"' mediaid='"[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#7E3794][FONT=Inconsolata]C2[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=green][FONT=Inconsolata]"' poster='"[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#11A9CC][FONT=Inconsolata]D2[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata]&[/FONT][/COLOR][COLOR=#000000][FONT=Inconsolata] [/FONT][/COLOR][COLOR=green][FONT=Inconsolata]"']"

Works in Excel and Google Sheets
 
Upvote 0
Woops it messed up my formula:

="[jw source='" & B2 & "' mediaid='" & C2 & "' poster='" & D2 & "']"

Works in Excel and Google Sheets
 
Upvote 0

Forum statistics

Threads
1,214,893
Messages
6,122,121
Members
449,066
Latest member
Andyg666

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