+ Reply to Thread
Results 1 to 10 of 10

text formula + formatting

  1. #1
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,224

    text formula + formatting

    hello all

    having some issue with text formula

    Part A:

    TEXT(M26-G26,"$#,#")

    in the above, i want to show the "$" by two decimals i.e. $2.06; right now it shows $2
    -in addition, i want it to go "red" with brackets if it is less than 0 i.e. red --> ($6.21).

    Part B:

    TEXT(((M26-G26)/G26),"##.##%")

    I want the above percentage to show in red and in brackets when below 0.00%

    Thank you all!

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: text formula + formatting

    try something like this

    Please Login or Register  to view this content.
    similiar for the %
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,224

    Re: text formula + formatting

    Quote Originally Posted by judgeh59 View Post
    try something like this

    Please Login or Register  to view this content.
    similiar for the %
    hey

    I tried your approach:

    =TEXT(M37-G37,"$#,##0.00_);[Red]($#,##0.00)")

    the items appear in bracket but not in "Red"....if i remove the quotation marks, the formula doesnt work?

    thanks.

    this is my entire formula

    Please Login or Register  to view this content.
    Last edited by jw01; 03-19-2014 at 03:04 PM.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: text formula + formatting

    for part A, can you use ="$"&M26-G26?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: text formula + formatting

    Try this for Part A:

    =IF(G26>M26,"(","")&TEXT(ABS(M26-G26),"$#,##0.00")&IF(G26>M26,")","")

    and this for Part B:

    =IF(G26>M26,"(","")&TEXT(ABS((M26-G26)/G26),"#0.00%")&IF(G26>M26,")","")

    The TEXT function does not support colours in the format string, so you will need to apply conditional formatting to get red if M26-G26 is less than zero.

    Hope this helps.

    Pete
    Last edited by Pete_UK; 03-19-2014 at 03:11 PM.

  6. #6
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,224

    Re: text formula + formatting

    Quote Originally Posted by Pete_UK View Post
    Try this for Part A:

    =IF(G26>M26,"(","")&TEXT(ABS(M26-G26),"$#,##0.00")&IF(G26>M26,")","")

    and this for Part B:

    =IF(G26>M26,"(","")&TEXT(ABS((M26-G26)/G26),"#0.00%")&IF(G26>M26,")","")

    The TEXT function does not support colours in the format string, so you will need to apply conditional formatting to get red if M26-G26 is less than zero.

    Hope this helps.

    Pete
    hey Pete

    How do i merge both Part A and Part B based on your formula?

    my primary formula is derived off "choose" formula i.e. see below:
    =CHOOSE($S$21,TEXT(M26-G26,"#,##_);[Red](#,##)"),TEXT(((M26-G26)/G26),"#,##0.00%_);[Red](#,##0.00%)"))

    Thanks again!

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: text formula + formatting

    Try this:

    =IF($S$21=1,IF(G26>M26,"(","")&TEXT(ABS(M26-G26),"$#,##0.00")&IF(G26>M26,")",""),IF(G26>M26,"(","")&TEXT(ABS((M26-G26)/G26),"#0.00%")&IF(G26>M26,")",""))

    Don't forget the CF to turn it red.

    Hope this helps.

    Pete

  8. #8
    Forum Contributor
    Join Date
    11-26-2010
    Location
    usa
    MS-Off Ver
    Office 365
    Posts
    1,224

    Re: text formula + formatting

    Quote Originally Posted by Pete_UK View Post
    Try this:

    =IF($S$21=1,IF(G26>M26,"(","")&TEXT(ABS(M26-G26),"$#,##0.00")&IF(G26>M26,")",""),IF(G26>M26,"(","")&TEXT(ABS((M26-G26)/G26),"#0.00%")&IF(G26>M26,")",""))

    Don't forget the CF to turn it red.

    Hope this helps.

    Pete
    hey Pete

    using your formula...i still cannot color condition to show red - the same issue as the choose formula i had.

    i highlighted the range and CF for less than 0 and it shows nothing. it is not recognizing the # format i assume...any way to work around that?

    thx u

  9. #9
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,290

    Re: text formula + formatting

    Maybe this??
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: text formula + formatting

    Borrowing popipipo's workbook, I've put the formula from Post #7 in cell J26, which is now formatted as General. I've applied conditional formatting to that cell to turn it red if negative. You can use cell S21 to change the units - set to 1 the units will be $, but any other value in S21 (or blank) will return %.

    Hope this helps.

    Pete
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula bar and text formatting
    By jgallan in forum Excel General
    Replies: 1
    Last Post: 10-20-2013, 07:17 PM
  2. Copying Text Formatting with a Formula
    By Kvh in forum Excel General
    Replies: 1
    Last Post: 11-19-2009, 01:53 AM
  3. Formatting text to formula
    By Kajima01 in forum Excel General
    Replies: 1
    Last Post: 11-13-2009, 10:00 AM
  4. Conditional formatting - formula=text
    By duckboy1981 in forum Excel General
    Replies: 3
    Last Post: 09-16-2009, 11:36 AM
  5. Text formatting/markup in a formula - possible?
    By nzmike in forum Excel General
    Replies: 2
    Last Post: 08-30-2009, 03:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1