Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default Formula Text String: Formatting Text and Numbers?

Excel 2003

If I havea text string formula and I insert a number. How do I get the
number to be formated with the comma
for "thousands"
[A1]
= "I want to purchase " &C2& " candy bars from the grocery store"

= "I want to purchase " 10,000 " candy bars from the grocery store"

I tried TEXT(A1,#,###) and doesnt work
Also, I want to put only a couple of words in bold font?. For example the
word "purchase".


  #2   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Formula Text String: Formatting Text and Numbers?

a partial response is to use TEXT(A1,"#,###") with quote marks
making part of it be bold would require code.

"dj479794" wrote:

Excel 2003

If I havea text string formula and I insert a number. How do I get the
number to be formated with the comma
for "thousands"
[A1]
= "I want to purchase " &C2& " candy bars from the grocery store"

= "I want to purchase " 10,000 " candy bars from the grocery store"

I tried TEXT(A1,#,###) and doesnt work
Also, I want to put only a couple of words in bold font?. For example the
word "purchase".


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default Formula Text String: Formatting Text and Numbers?

If I havea text string formula and I insert a number. How do I get the
number to be formated with the comma
for "thousands"
[A1]
= "I want to purchase " &C2& " candy bars from the grocery store"

= "I want to purchase " 10,000 " candy bars from the grocery store"

I tried TEXT(A1,#,###) and doesnt work


Are you allowed to change the formula in A1?

A1: = "I want to purchase " &TEXT(C2,"#,###")& " candy bars from the grocery
store"

Rick

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default Formula Text String: Formatting Text and Numbers?

Not exactly sure what you mean. The formula in A1 can change, my goal is to
have a setence in which the number of candy bars changes based on another
cells results. Even though that other cell is formated correctly (number with
a common in the thousands) it doesn't carry over. I also need one of the
words in the setence to be in bold font. Open to ideas.

"Rick Rothstein (MVP - VB)" wrote:

If I havea text string formula and I insert a number. How do I get the
number to be formated with the comma
for "thousands"
[A1]
= "I want to purchase " &C2& " candy bars from the grocery store"

= "I want to purchase " 10,000 " candy bars from the grocery store"

I tried TEXT(A1,#,###) and doesnt work


Are you allowed to change the formula in A1?

A1: = "I want to purchase " &TEXT(C2,"#,###")& " candy bars from the grocery
store"

Rick


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default Formula Text String: Formatting Text and Numbers?

It will carry over if you use the formula that was provided by Rick


--
Regards,

Peo Sjoblom




"dj479794" wrote in message
...
Not exactly sure what you mean. The formula in A1 can change, my goal is
to
have a setence in which the number of candy bars changes based on another
cells results. Even though that other cell is formated correctly (number
with
a common in the thousands) it doesn't carry over. I also need one of the
words in the setence to be in bold font. Open to ideas.

"Rick Rothstein (MVP - VB)" wrote:

If I havea text string formula and I insert a number. How do I get the
number to be formated with the comma
for "thousands"
[A1]
= "I want to purchase " &C2& " candy bars from the grocery store"

= "I want to purchase " 10,000 " candy bars from the grocery store"

I tried TEXT(A1,#,###) and doesnt work


Are you allowed to change the formula in A1?

A1: = "I want to purchase " &TEXT(C2,"#,###")& " candy bars from the
grocery
store"

Rick






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Formula Text String: Formatting Text and Numbers?

On Fri, 29 Jun 2007 13:28:04 -0700, dj479794
wrote:

Excel 2003

If I havea text string formula and I insert a number. How do I get the
number to be formated with the comma
for "thousands"
[A1]
= "I want to purchase " &C2& " candy bars from the grocery store"

= "I want to purchase " 10,000 " candy bars from the grocery store"

I tried TEXT(A1,#,###) and doesnt work
Also, I want to put only a couple of words in bold font?. For example the
word "purchase".


If the number of candy bars is in C2, then:

A1:
= "I want to purchase " &TEXT(C2,"#,###")
& " candy bars from the grocery store"

will format the value as you describe.

However to bold the word purchase, you will need to use a macro that will place
a text string into A1, rather than a formula. You cannot, in Excel, bold part
of a formula result.

Here's one way:

Right click on the sheet tab.
Select "View Code"
Paste the following into the window that appears.

Type some number into C2.

You will need to modify this to your specific requirements.

=========================================
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Const s1 As String = "I want to purchase "
Const s2 As String = " candy bars from the grocery store."
Const sFmt As String = "#,###"
Const sTextToBold As String = "purchase"

With Range("A1")
.Value = s1 & Format(Range("c2"), sFmt) & s2
.Characters(InStr(1, Range("a1").Text, sTextToBold),
Len(sTextToBold)).Font.Bold = True
End With

End Sub
========================================
--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pull numbers from text string [email protected] Excel Discussion (Misc queries) 7 March 19th 07 06:04 PM
Extracting numbers from string of text Marie Excel Discussion (Misc queries) 2 November 21st 06 09:46 PM
combining text and numbers in a string ajd Excel Worksheet Functions 2 November 3rd 06 04:17 PM
extracting numbers within text string! via135 Excel Worksheet Functions 6 May 5th 06 06:08 AM
EXTRACT NUMBERS FROM TEXT STRING fiber_doc Excel Worksheet Functions 4 November 28th 05 06:40 PM


All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"