Adding text to cell in a range of cells based on condition

cbwin

New Member
Joined
Jan 27, 2023
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Hello,

I need help adding text into cells in a range based on a condition. Adding the formula directly into all cells in the range doesn't work, because
1. I would like to do this for more than one specific-text-based-on-condition combo, and
2. If the formula is in the cell directly, it doesn't allow the text to overflow to adjacent cells, making it unreadable.

Is there vba that can do this? a screenshot of my sheet is included. Essentially, there are columns on the left (A:K) that dictate the bars that show up in a range of cells (dates; M:CQ) on the right. What I'm trying to do right now is essentially conditional formatting (how the bars, etc. in the righthand range are set up), but for adding text. The way I'm thinking about it right now is if G$8=M$4 (ie, the end date of an activity matches the column of that date), add the text in D$8 (ie, the activity name) in N$8 (ie, the cell after the end date) in italics. So, I'm trying to get the activity name of a given line to pop up in italics after the end of the bar for that line.

Again, as you can see on the sheet, there is other text in the range of dates (eg, AR11 has the text "(1.2)"), so I need something that is not inputting a formula directly in the cells of the range, but rather a macro that inputs text in the cells in the righthand range based on the cells in the lefthand range (specifically, the G column).

Any help is appreciated! Thank you!
 

Attachments

  • Gantt Chart screenshot.PNG
    Gantt Chart screenshot.PNG
    39.5 KB · Views: 16

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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