Change font size when concatenating text

ilcaa

Well-known Member
Joined
May 25, 2005
Messages
751
Office Version
  1. 365
Platform
  1. Windows
hello, i am concatenating text within a cell with formula and references to text along with text... is there a way to change the size of my Text in various portions of my formula?

=VLOOKUP($B$3,'sample dashboard'!$D$4:$AG$116,24,FALSE) & " Top Tiers Ordered" & " National Average" & $A$1

I want to change the font size at the end (" National Average" & $A$1) to 12 and front portion (=VLOOKUP($B$3,'sample dashboard'!$D$4:$AG$116,24,FALSE) & " Top Tiers Ordered") to 15 Font

is this possible... how?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I'm not aware of any method of doing this using formulas alone - I think you need a VBA solution, although I'm happy to be proven wrong.
The following puts the formula into cell D3 on "Sheet1" returning a Vlookup value from the sheet "sample dashboard" - change these parameters to suit.

VBA Code:
Option Explicit
Sub test()
    Dim ws1 As Worksheet, ws2 As Worksheet, s As String, n As Long, x As Long
    Set ws1 = Worksheets("Sheet1")              '<~~ *** Change sheet names as required ***
    Set ws2 = Worksheets("sample dashboard")
    
    With ws1.Range("D3")
        .Formula = "=VLOOKUP($B$3,'sample dashboard'!$D$4:$AG$116,24,FALSE) & "" Top Tiers Ordered"" & "" National Average"" & $A$1"
        .Value = .Value
        s = .Value
        .Font.Size = 15
        n = InStr(s, " National")
        For x = n To Len(s)
            .Characters(x, 1).Font.Size = 12
        Next x
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,222
Members
453,024
Latest member
Wingit77

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