PC Review


Reply
Thread Tools Rate Thread

can I color true or false results differently in excel

 
 
JT
Guest
Posts: n/a
 
      11th Apr 2008
I want to identify the day of the week in my spreadsheet and have used the
formula

=IF(WEEKDAY(L2)=1,"SU",IF(WEEKDAY(L2)=2,"M",IF(WEEKDAY(L2)=3,"T",IF(WEEKDAY(L2)=4,"W",IF(WEEKDAY(L2)=5,"TH",IF(WEEKDAY(L2)=6,"F",IF(WEEKDAY(L2)=7,"SA","")))))))

where the L2 cell would have a date (ie 04/10/2008) but would like the
weekdays (M-F) to be black and have SA and SU come up red. any ideas /
suggestions?
 
Reply With Quote
 
 
 
 
Mark Ivey
Guest
Posts: n/a
 
      11th Apr 2008
What about just using conditional formatting?

Mark Ivey

"JT" <(E-Mail Removed)> wrote in message
news:A16DBADB-9518-4DF4-B64D-(E-Mail Removed)...
> I want to identify the day of the week in my spreadsheet and have used the
> formula
>
> =IF(WEEKDAY(L2)=1,"SU",IF(WEEKDAY(L2)=2,"M",IF(WEEKDAY(L2)=3,"T",IF(WEEKDAY(L2)=4,"W",IF(WEEKDAY(L2)=5,"TH",IF(WEEKDAY(L2)=6,"F",IF(WEEKDAY(L2)=7,"SA","")))))))
>
> where the L2 cell would have a date (ie 04/10/2008) but would like the
> weekdays (M-F) to be black and have SA and SU come up red. any ideas /
> suggestions?


 
Reply With Quote
 
Mike
Guest
Posts: n/a
 
      11th Apr 2008
Paste this code into the worksheet that your formula is in
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Range("B2")
Select Case .Value
Case "M", "T", "W", "TH", "F"
.Interior.ColorIndex = 1
.Font.ColorIndex = 2
Case "SA", "SU"
.Interior.ColorIndex = 3
.Font.ColorIndex = 2
Case Else
.Interior.ColorIndex = 2
.Font.ColorIndex = 1
End Select
End With
End Sub

"JT" wrote:

> I want to identify the day of the week in my spreadsheet and have used the
> formula
>
> =IF(WEEKDAY(L2)=1,"SU",IF(WEEKDAY(L2)=2,"M",IF(WEEKDAY(L2)=3,"T",IF(WEEKDAY(L2)=4,"W",IF(WEEKDAY(L2)=5,"TH",IF(WEEKDAY(L2)=6,"F",IF(WEEKDAY(L2)=7,"SA","")))))))
>
> where the L2 cell would have a date (ie 04/10/2008) but would like the
> weekdays (M-F) to be black and have SA and SU come up red. any ideas /
> suggestions?

 
Reply With Quote
 
JT
Guest
Posts: n/a
 
      11th Apr 2008
I think that both of you guys are WAY ABOVE my programming level. Thanks for
the help but I think I should have put my question in the beguinners category
since I really don't know what conditional formatting is let alone how to do
it.

sorry to waste your time.
JT

 
Reply With Quote
 
JT
Guest
Posts: n/a
 
      11th Apr 2008
I think that both of you guys are WAY ABOVE my programming level. Thanks for
the help but I think I should have put my question in the beguinners
category. I have tried to copy the subroutine that you sent to several cells
in my worksheet and either get text of the subroutine or, if I start it with
"=" and the subroutine all in one cell, excell calls an error and highlights
the term ".value" in the subroutine. I have also tried messing with the With
Range("B2") line and tried both With Range(O20) {a cell that is Saturday} and
With Range(O2:O32) {the 31 cells to correspond to the 31 possible dates per
month} and had no luck.

Thanks for the effort.
sorry to waste your time.
JT


 
Reply With Quote
 
JT
Guest
Posts: n/a
 
      11th Apr 2008
Strike my reply to your answer Mark. I just found a link to conditional
formating and, WOW, what a powerful tool. Great suggestion! Now my weekdays
are black with Green background and the weekends are white with red
backgrounds. More than I had in mind.

If I did this right the link that I followed was
http://www.contextures.com/xlCondFormat01.html
if not, then this is the webpage I used. (Like I said, I am not much of a
programmer, typical 52 year old who didn't get his first computer till he was
40'ish)

Thanks again Mike.
JT
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Microsoft Excel Discussion 9 29th Jul 2008 12:28 AM
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Microsoft Excel Programming 9 29th Jul 2008 12:28 AM
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Microsoft Excel Misc 9 29th Jul 2008 12:28 AM
Adding True False Results =?Utf-8?B?QXJsYSBN?= Microsoft Excel Worksheet Functions 6 27th Jan 2005 06:29 PM
text color change if value is true, another color if value is false =?Utf-8?B?TWljaGVsbGUgU2hlbGRvbg==?= Microsoft Excel Misc 4 26th Feb 2004 04:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:23 PM.