Excel: Different formatting on different values in same cell

Newbie

I have the following formula in excel:

=TEXTO(D39;"#.##0")&" "&"("&TEXTO(D40;"0%")&")"

This formula returns an output with a size in the cell -- left number in this picture:
change size

I need to change the formatting of the percentage portion of the formula's output in the cell (see the example to the right).

How can I do it?

I know how to do this when I have no formulas (just numbers or text), I tried to follow the same procedure to this case, but it does not work.

dmb

No, there is no way to do this with a formula and if you have formulas in the cell. Can you have different sized fonts in a cell? Yes. Can this be done any other way? Yes, mostly involves VBA but that is out of the scope of this question.

The thing is that Excel Formulas return a Value, which ever be it's nature, and not formating. Formatting is applied to the data, in the cell, so it suits the representation you want, like for date formatting. Dates are stored serialised in Excel and usually they are represented by the locale date format.

For an VBA aproach you will have to parse the cell data using a function like InSTR() to split the numeric value from the percentage value. Then you would apply the format you want to either part and return it to the cell.

Cheers.

EDIT:

As you can see down here there is another way that involves counting the characters and applying the desired format. I've recorded a small macro for you to use as a template.

Sub Macro1()
'
' Macro1 Macro
'

'
Range("H13").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Dude(11,3%)"
Range("H13").Select
ActiveCell.FormulaR1C1 = "Dude(11,3%)"

With ActiveCell.Characters(Start:=1, Length:=13).Font
    .Name = "Tahoma"
    .FontStyle = "Normal"
    .Size = 8
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    .ThemeFont = xlThemeFontNone
End With

With ActiveCell.Characters(Start:=14, Length:=7).Font
    .Name = "Tahoma"
    .FontStyle = "Normal"
    .Size = 20
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    .ThemeFont = xlThemeFontNone
End With
Range("I13").Select
End Sub

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Conditional formatting with different formats in the same cell

From Dev

Excel cell limit - Different results for same scenario

From Dev

How to find same values from different cell in Excel file using C#

From Dev

Transfer cell values from different columns and sheets from multiple excel files with same structure into a single dataframe

From Dev

Conditional formatting with values ​in different cells

From Dev

How to use different colors of texts in same Excel cell using ClosedXML?

From Dev

Oracle: Sum cell values for same id but different groups

From Dev

Excel Formula to COUNT and add 2 different values in a cell range.

From Dev

MS Excel 2013 - Function based upon different cell values

From Dev

Excel Count Different Values

From Dev

Excel between times returns different values in same range

From Dev

Excel sort maintaining equal values in different columns in the same position

From Dev

Excel summing values based on value of different column in same row

From Dev

Leaving a cell blank in excel, or display a different cell

From Dev

Excel if blank cell use different cell in formula

From Dev

Formatting output using different elements of the same tuple

From Dev

Excel conditional formatting with Data Bars of different ranges

From Dev

Conditional Formatting in Excel via a different worksheet

From Dev

excel conditional formatting comparing different rows and columns

From Dev

Different values of same variable at different places in jquery

From Dev

Same date in different format returning different values

From Dev

Different values in different instances of the same usercontrol in WPF

From Dev

Java same enum with different values

From Dev

Passing different values to the same directives

From Dev

Same object property with different values

From Dev

Addition with the same prompt, but different values

From Dev

same key with different values dictionary

From Dev

Excel compare sheets find value & replace value, same row - different cell

From Dev

Gridlayout, different action to each cell on same mousevent

Related Related

  1. 1

    Conditional formatting with different formats in the same cell

  2. 2

    Excel cell limit - Different results for same scenario

  3. 3

    How to find same values from different cell in Excel file using C#

  4. 4

    Transfer cell values from different columns and sheets from multiple excel files with same structure into a single dataframe

  5. 5

    Conditional formatting with values ​in different cells

  6. 6

    How to use different colors of texts in same Excel cell using ClosedXML?

  7. 7

    Oracle: Sum cell values for same id but different groups

  8. 8

    Excel Formula to COUNT and add 2 different values in a cell range.

  9. 9

    MS Excel 2013 - Function based upon different cell values

  10. 10

    Excel Count Different Values

  11. 11

    Excel between times returns different values in same range

  12. 12

    Excel sort maintaining equal values in different columns in the same position

  13. 13

    Excel summing values based on value of different column in same row

  14. 14

    Leaving a cell blank in excel, or display a different cell

  15. 15

    Excel if blank cell use different cell in formula

  16. 16

    Formatting output using different elements of the same tuple

  17. 17

    Excel conditional formatting with Data Bars of different ranges

  18. 18

    Conditional Formatting in Excel via a different worksheet

  19. 19

    excel conditional formatting comparing different rows and columns

  20. 20

    Different values of same variable at different places in jquery

  21. 21

    Same date in different format returning different values

  22. 22

    Different values in different instances of the same usercontrol in WPF

  23. 23

    Java same enum with different values

  24. 24

    Passing different values to the same directives

  25. 25

    Same object property with different values

  26. 26

    Addition with the same prompt, but different values

  27. 27

    same key with different values dictionary

  28. 28

    Excel compare sheets find value & replace value, same row - different cell

  29. 29

    Gridlayout, different action to each cell on same mousevent

HotTag

Archive