change the color of font

Memar

Board Regular
Joined
Sep 2, 2011
Messages
76
I want to change the color of fonts or cells by matching the date from a different workbook. I have a projection of sales in one workbook and actual sales in a different workbook. Whenever we get the actual total sold product types for the month, I want to deduct those form the projection workbook. Thus, I want to differentiate the by coloring the fonts or changing the color of the cell. Would you please help me how I can do this in Excel?

Data in the first workbook
Projected Sells by month
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]1/31/2019[/TD]
[TD]2/28/2019[/TD]
[TD]3/31/2019[/TD]
[TD]4/30/2019[/TD]
[TD]5/31/2019[/TD]
[TD]6/30/2019[/TD]
[TD]7/31/2019[/TD]
[TD] TOTAL [/TD]
[/TR]
[TR]
[TD]Product A [/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]7000[/TD]
[/TR]
[TR]
[TD]Product B[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]700[/TD]
[/TR]
[TR]
[TD]Product C[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]3500[/TD]
[/TR]
[TR]
[TD]Product D[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]2100[/TD]
[/TR]
[TR]
[TD]Product F[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]4200[/TD]
[/TR]
[TR]
[TD]ProductG [/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]1400[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Data in the second workbook
Actual Sales

[TABLE="width: 500"]
<tbody>[TR]
[TD]Accounting date [/TD]
[TD]Product Type [/TD]
[TD]Amount Sold [/TD]
[/TR]
[TR]
[TD]1/31/2019[/TD]
[TD]Product A [/TD]
[TD]600[/TD]
[/TR]
[TR]
[TD]1/31/2019[/TD]
[TD]Product B[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]1/31/2019[/TD]
[TD]Product C [/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]1/31/2019[/TD]
[TD]Product F[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD]2/28/2019[/TD]
[TD]Product C[/TD]
[TD]600[/TD]
[/TR]
[TR]
[TD]2/28/2019[/TD]
[TD]Product D[/TD]
[TD]400[/TD]
[/TR]
[TR]
[TD]2/28/2019[/TD]
[TD]Product F[/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]3/31/2019[/TD]
[TD]Product A [/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]3/31/2019[/TD]
[TD]Product B[/TD]
[TD]150[/TD]
[/TR]
[TR]
[TD]3/31/2019[/TD]
[TD]Product C[/TD]
[TD]500[/TD]
[/TR]
</tbody>[/TABLE]



DESIRED RESULT
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]1/31/2019[/TD]
[TD]2/28/2019[/TD]
[TD]3/31/2019[/TD]
[TD]4/30/2019[/TD]
[TD]5/31/2019[/TD]
[TD]6/30/2019[/TD]
[TD] TOTAL [/TD]
[/TR]
[TR]
[TD]Product A [/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]7000[/TD]
[/TR]
[TR]
[TD]Product B[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]700[/TD]
[/TR]
[TR]
[TD]Product C[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]500[/TD]
[TD]3500[/TD]
[/TR]
[TR]
[TD]Product D[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]2100[/TD]
[/TR]
[TR]
[TD]Product F[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]600[/TD]
[TD]4200[/TD]
[/TR]
[TR]
[TD]ProductG [/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]1400[/TD]
[/TR]
</tbody>[/TABLE]




Thank you for your help and time.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi Memar,
Warning: I am no expert. But I love trying to color things. I tried this and it works for me.

Code:
Sub colorCodeGreenOrRed()
'
' colorCode
'


'


   If Range("A21") <= 1000 Then
   
   Range("A21").Interior.Color = -16776961
   
   Else
   
   If Range("A21") > 1000 Then
      
   Range("A21").Interior.Color = 5287936
   
   
    
    End If
    End If

end sub



You can run it by applying to a button or manually running it. Macro>Run.

thanks,
Nej
 
Last edited:
Upvote 0
If "1/13/2019" is in B1, you could use Conditional Formatting on B2 with the formula
=(B$1 < MAX(Sheet2!$A:$A) )


Its not clear to me how coloring the cells will help "deduct them from the projection workbook".
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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