If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > If statements

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-01-04, 14:25
waternut waternut is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
If statements

If have a spreadsheet where I enter in one column if the information is a letter of credit, bond, or check. Can I create an if, then statement which if I type L.O.C. for letter of credit it would either turn all the text in that row red or highlight the text in yellow? Or is the if, then statement only applicable to numerical data? thanks for your help with this

Chris
Reply With Quote
  #2 (permalink)  
Old 03-01-04, 15:10
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Welcome to the board!
====================

You can use conditional formatting, if I understand what you want:

Suppose that you column is A that has your choices (LOC, BON, CHE)

then select entire table, go to FORMAT > CONDITIONAL FORMATTING

Then in the drop down at the left of the dialog box, choose "Formula Is"

then put this into the box (be sure that the $ sign is in the appropriate place):

=$A1="LOC"

and choose your formatting

Then for condition 2, do the same, only put this formula into the box:

=$A1="BON"

and choose it's formatting.

If you want a third condition, do the same.

Click OK.

If you copy/add rows at the bottom the conditional formatting should apply automatically.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 03-01-04, 15:34
waternut waternut is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
conditional formatting

I guess I didn't write my question very well. To give you a better idea I have this spreadsheet which I add to as needed the "K" column identifies if the surety is a bond letter of credit or check. I need for the spreadsheet to highlight the row the L.O.C. is in in yellow if I type in L.O.C. for that project is this possible? I am trying to get around doing conditional formatting everytime I enter a new project
Reply With Quote
  #4 (permalink)  
Old 03-03-04, 09:18
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Actually if you use conditionally formatting (as described, except in your case replace $A1 with $K1), then you can select any line, and hit the Painter button to copy the format, then select as many rows as you need and even though they are blank, any time you add an entry into column K, the line will turn the appropriate color.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #5 (permalink)  
Old 03-03-04, 10:41
waternut waternut is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
Unhappy

Sorry not as advanced as you VBA guys but thanks for the help this makes it work real nice, thanks again
Reply With Quote
  #6 (permalink)  
Old 03-03-04, 11:16
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Hope this works for you.

BTW, there is no VBA involved in this solution.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #7 (permalink)  
Old 03-03-04, 12:42
waternut waternut is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
here is a question

Say I want to have mutiple columns within one row return a cell shading of yellow if in column K row whatever has the statement L.O.C.? The formatting works good for one cell for instance using the conditional formatting =$k2="L.O.C." then if I type L.O.C. in that cell the cell turns yellow but what if I cells A2 through P2 to turn yellow if I type L.O.C. in k2 can I do that? thanks for the help
Reply With Quote
  #8 (permalink)  
Old 03-03-04, 13:14
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
As long as you select the columns before you do the conditional formatting. And most crucial, make sure the reference is to: $K1. The dollar sign means that all columns will only check that column for the criteria to be met. But you don't want the dollar sign in front of the number because you want each row to have that reference.. So if your data starts with row 2, then your formula in the conditional formatting dialog box under "Formula Is" will be

=$K2="L.O.C."

Note, that if you have selected all the elements of the table prior to opening the Conditional Formatting dialog box, then you only need to reference the first row. Excel assumes you mean that row 3 will be $K3, etc.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #9 (permalink)  
Old 03-31-04, 22:14
rickyckc rickyckc is offline
Registered User
 
Join Date: Mar 2004
Location: Singapore
Posts: 5
Cool

Shades,

Excel allows only up to 3 conditions. What will the VB script be like if I want more than 3 conditions ?

Thanks.

Best Regards,
Ricky
Reply With Quote
  #10 (permalink)  
Old 04-01-04, 11:53
texasalynn texasalynn is offline
Registered User
 
Join Date: Jun 2002
Location: Houston, TX
Posts: 116
Here is a solution that I found that might help you out.

http://www.mrexcel.com/board2/viewto...itional+format


HTH
texasalynn
Reply With Quote
  #11 (permalink)  
Old 04-01-04, 20:26
rickyckc rickyckc is offline
Registered User
 
Join Date: Mar 2004
Location: Singapore
Posts: 5
Thanks texasalynn for the reply, will check it out later

Best Regards,
Ricky
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On