Can you format text with a formula?

BAMF

Board Regular
Joined
Jun 20, 2004
Messages
62
Hello everyone! I'm tying to automate something relatively simple, but I am getting my butt handed to me. I need to underline text which is populated from a formula. The formula is quite simple but the formatting is killing me. I know how to format numbers, dollars and dates within a formula, but I can't figure out how to underline text. Please help!

Desired Result
The employee's who sold more than 100 cars this month are: Alex, Mike and Tim. Please congratulate them on their performance!

Formula being used
="The employee's who sold more than 100 cars this month are: "&cell reference&"Please congratulate them on their performance!"

Current result
The employee's who sold more than 100 cars this month are: Alex Mike Tim Please congratulate them on their performance!

Attempts
I wish underlining text were an option within Format Cells/Custom so I could just use the formula =text(cell reference, "underline"). However, I don't see that as an option in the 2007 or 2010 versions. Is there a way to add "underline text" as my own custom format?

I also tried using "Conditional Formatting" (both "Format cells only that contain" and "Use a formula to determine which cells to format)." I can't quite get it because I don't know how to list names for the former conditional formatting. Vlookup is the only way I know how to refer to a list for the formula based conditional formatting, but this would stop after the first name on the list is found and ignore the rest of them. If a guru knows of a way to automate this formatting issue I'd be happy to buy him a beer! Thank you.
 
Remark: the code above works if A1 is updated mannualy. A formula in A1 won't trigger the event.
We can probably work around that problem once we know what cells the formula referernces, which is why I asked the several questions that I did in Message #8.
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
We can probably work around that problem once we know what cells the formula referernces, which is why I asked the several questions that I did in Message #8.

If there is a formula in A1 *maybe* the property DirectDependents can help.

M.
 
Upvote 0
If there is a formula in A1 *maybe* the property DirectDependents can help.
Another way besides that (especially if there are cell references to other worksheets) would be to replace the formula and add VB code to imitate what the formula does, then add the formatting to that code... that would give you the most control.
 
Upvote 0
Another way besides that (especially if there are cell references to other worksheets) would be to replace the formula and add VB code to imitate what the formula does, then add the formatting to that code... that would give you the most control.

Yes, you are right.

M.
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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