Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default adding a cell in a text string

I wanted to add a cell (formula) within a text string. I found the
syntax but when I did it, the cells would leave values with decimal
points. My original cells were formatted with no decimals (whole
numbers only) but inside the text string I get decimals and in some
cases 6 or more. How can I get rid of the decimals?

Hopefully this made sense. Thanks in advance for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default adding a cell in a text string

If this is a VB question (you posted your question in a programming
newsgroup), show us your code. If this is a worksheet formula question, then
show us your formula.

--
Rick (MVP - Excel)


"Seemore" wrote in message
...
I wanted to add a cell (formula) within a text string. I found the
syntax but when I did it, the cells would leave values with decimal
points. My original cells were formatted with no decimals (whole
numbers only) but inside the text string I get decimals and in some
cases 6 or more. How can I get rid of the decimals?

Hopefully this made sense. Thanks in advance for your help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default adding a cell in a text string

On Aug 10, 4:05*pm, "Rick Rothstein"
wrote:
If this is a VB question (you posted your question in a programming
newsgroup), show us your code. If this is a worksheet formula question, then
show us your formula.

--
Rick (MVP - Excel)

"Seemore" wrote in message

...



I wanted to add a cell (formula) within a text string. *I found the
syntax but when I did it, the cells would leave values with decimal
points. *My original cells were formatted with no decimals (whole
numbers only) but inside the text string I get decimals and in some
cases 6 or more. *How can I get rid of the decimals?


Hopefully this made sense. *Thanks in advance for your help.- Hide quoted text -


- Show quoted text -




The string that i used is ="If you pay $Sheet3!$J$5&" over 15 years,
you will have paid a total of $"&Sheet3!L18&"." The first cell
gives me 2 decimals and the second gives me 9. I would prefer whole
numbers instead. I appreciate the help and will also seek the help of
the other group you mentioned.

Thanks again for your help.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default adding a cell in a text string

On Aug 11, 9:45*am, "Don Guillett" wrote:
try int(rng)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Seemore" wrote in message

...
On Aug 10, 4:05 pm, "Rick Rothstein"





wrote:
If this is a VB question (you posted your question in a programming
newsgroup), show us your code. If this is a worksheet formula question,
then
show us your formula.


--
Rick (MVP - Excel)


"Seemore" wrote in message


....


I wanted to add a cell (formula) within a text string. I found the
syntax but when I did it, the cells would leave values with decimal
points. My original cells were formatted with no decimals (whole
numbers only) but inside the text string I get decimals and in some
cases 6 or more. How can I get rid of the decimals?


Hopefully this made sense. Thanks in advance for your help.- Hide quoted
text -


- Show quoted text -


The string that i used is ="If you pay $Sheet3!$J$5&" over 15 years,
you will have paid a total of $"&Sheet3!L18&"." * *The first cell
gives me 2 decimals and the second gives me 9. *I would prefer whole
numbers instead. *I appreciate the help and will also seek the help of
the other group you mentioned.

Thanks again for your help.- Hide quoted text -

- Show quoted text -


Thanks. Int seemed to have gotten rid of the decimals. The number
however does not have any commas nor a $. The original cell is
formatted for currency and no decimals. I was able to overcome the $
issue by just adding it as text which works but commas would be very
helpful.

Thanks.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default adding a cell in a text string

$1,026

="ddddddddddddd "& TEXT(O7,"$#,##0")& " dddddddd" &
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Seemore" wrote in message
...
On Aug 11, 9:45 am, "Don Guillett" wrote:
try int(rng)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Seemore" wrote in message

...
On Aug 10, 4:05 pm, "Rick Rothstein"





wrote:
If this is a VB question (you posted your question in a programming
newsgroup), show us your code. If this is a worksheet formula question,
then
show us your formula.


--
Rick (MVP - Excel)


"Seemore" wrote in message


...


I wanted to add a cell (formula) within a text string. I found the
syntax but when I did it, the cells would leave values with decimal
points. My original cells were formatted with no decimals (whole
numbers only) but inside the text string I get decimals and in some
cases 6 or more. How can I get rid of the decimals?


Hopefully this made sense. Thanks in advance for your help.- Hide
quoted
text -


- Show quoted text -


The string that i used is ="If you pay $Sheet3!$J$5&" over 15 years,
you will have paid a total of $"&Sheet3!L18&"." The first cell
gives me 2 decimals and the second gives me 9. I would prefer whole
numbers instead. I appreciate the help and will also seek the help of
the other group you mentioned.

Thanks again for your help.- Hide quoted text -

- Show quoted text -


Thanks. Int seemed to have gotten rid of the decimals. The number
however does not have any commas nor a $. The original cell is
formatted for currency and no decimals. I was able to overcome the $
issue by just adding it as text which works but commas would be very
helpful.

Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default adding a cell in a text string

On Tue, 11 Aug 2009 06:23:18 -0700 (PDT), Seemore
wrote:

The string that i used is ="If you pay $Sheet3!$J$5&" over 15 years,
you will have paid a total of $"&Sheet3!L18&"." The first cell
gives me 2 decimals and the second gives me 9. I would prefer whole
numbers instead. I appreciate the help and will also seek the help of
the other group you mentioned.


You have to do the formatting within the text statement.

You probably want something like:

="If you pay "&TEXT(Sheet3!$J$5,"$#,##0")
&" over 15 years, you will have paid a total of "&
TEXT(Sheet3!L18,"$#,##0.")

The above formatting assumed you wanted zero decimal places, $ formatting
(select your own currency symbol if '$' is not appropriate), and that there was
nothing special to do about negative values.
--ron
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default adding a cell in a text string

On Aug 11, 10:42*am, Ron Rosenfeld wrote:
On Tue, 11 Aug 2009 06:23:18 -0700
wrote:

The string that i used is ="If you pay $Sheet3!$J$5&" over 15 years,
you will have paid a total of $"&Sheet3!L18&"." * *The first cell
gives me 2 decimals and the second gives me 9. *I would prefer whole
numbers instead. *I appreciate the help and will also seek the help of
the other group you mentioned.


You have to do the formatting within the text statement.

You probably want something like:

="If you pay "&TEXT(Sheet3!$J$5,"$#,##0")
&" over 15 years, you will have paid a total of "&
TEXT(Sheet3!L18,"$#,##0.")

The above formatting assumed you wanted zero decimal places, $ formatting
(select your own currency symbol if '$' is not appropriate), and that there was
nothing special to do about negative values.
--ron


That worked perfectly. In the future, if I decide I want decimals how
would I change it? Again, many thanks. These forums have saved me a
lot of headaches.
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default adding a cell in a text string

On Tue, 11 Aug 2009 08:50:50 -0700 (PDT), Seemore
wrote:

That worked perfectly. In the future, if I decide I want decimals how
would I change it? Again, many thanks. These forums have saved me a
lot of headaches.


Take a look at HELP for the TEXT worksheet function and also for "Number Format
Codes".

The format code you would use in the TEXT function is the same code you would
use if you custom formatted a cell (Format/Cells/Number/Custom Type: )

However, I used a little trick to put in the terminal ".", so it may not be
clear to you.

To redo the sentence to allow, for example, two decimals:

="If you pay "&TEXT(Sheet3!$J$5,"$#,##0.00")
&" over 15 years, you will have paid a total of "&
TEXT(Sheet3!L18,"$#,##0.00\.")

--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
Adding text string to cells Ray W. New Users to Excel 2 March 28th 08 02:33 PM
word match in string text in cell, color format cell jpmahony Excel Discussion (Misc queries) 1 October 31st 07 03:56 PM
Adding a micron symbol to text string Stopher Excel Programming 5 August 22nd 07 12:30 PM
Sumif text is contained winthin a longer text string in a cell Johnny M[_2_] Excel Worksheet Functions 3 March 21st 07 02:50 PM
Adding Text to a String Gene Haines Excel Discussion (Misc queries) 1 November 29th 06 05:34 AM


All times are GMT +1. The time now is 03:05 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"