Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I've been given a workbook to convert into Access. The users have manually formated row colors to indicate the status of an order. Is there a way to set the value of a cell depending on its color, as in =IF(COLOR=GRAY,CANCELED,)? Of course I have about 6 colors to deal with ,is there a way to nest this? Thanks, Todd |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
First enter a little function to return the color of a cell:
Function colorcode(cell As Range) As Integer colorcode = cell.Interior.ColorIndex End Function Then if you want to set the value of A1 based upon its color, enter the formula: =if(colorcode(A1)=15,"CANCELLED","") You will probably need to re-calculate the worksheet if you change cell colors because Excel may not realize the function colorcode will have to be re-executed. -- Gary's Student "tjack13" wrote: Hello, I've been given a workbook to convert into Access. The users have manually formated row colors to indicate the status of an order. Is there a way to set the value of a cell depending on its color, as in =IF(COLOR=GRAY,CANCELED,)? Of course I have about 6 colors to deal with ,is there a way to nest this? Thanks, Todd |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sun, 03 Sep 2006, tjack13 wrote:
I've been given a workbook to convert into Access. The users have manually formated row colors to indicate the status of an order. Is there a way to set the value of a cell depending on its color, as in =IF(COLOR=GRAY,CANCELED,)? Of course I have about 6 colors to deal with ,is there a way to nest this? Yes. What you are looking for is Cells(i,j).Interior.ColorIndex = The color indexes are integers. I'm not sure where it is documented what they are, but you can experiment. Don <www.donwiss.com (e-mail link at home page bottom). |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, that did it. Since there were 8 colors, I was able to get by
with the seven levels of IF nesting. Do you know of a way to deal with more color options? Todd Gary''s Student wrote: First enter a little function to return the color of a cell: Function colorcode(cell As Range) As Integer colorcode = cell.Interior.ColorIndex End Function Then if you want to set the value of A1 based upon its color, enter the formula: =if(colorcode(A1)=15,"CANCELLED","") You will probably need to re-calculate the worksheet if you change cell colors because Excel may not realize the function colorcode will have to be re-executed. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sun, 03 Sep 2006, tjack13 wrote:
I've been given a workbook to convert into Access. The users have manually formated row colors to indicate the status of an order. Is there a way to set the value of a cell depending on its color, as in =IF(COLOR=GRAY,CANCELED,)? Of course I have about 6 colors to deal with ,is there a way to nest this? Amd one more thing. The .Interior.ColorIndex ignores any conditional formatting. It always returns the core color. Don <www.donwiss.com (e-mail link at home page bottom). |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use the CHOOSE() function. See Excel Help. CHOOSE can handle up to
29 different picks. -- Gary's Student "tjack13" wrote: Thanks, that did it. Since there were 8 colors, I was able to get by with the seven levels of IF nesting. Do you know of a way to deal with more color options? Todd Gary''s Student wrote: First enter a little function to return the color of a cell: Function colorcode(cell As Range) As Integer colorcode = cell.Interior.ColorIndex End Function Then if you want to set the value of A1 based upon its color, enter the formula: =if(colorcode(A1)=15,"CANCELLED","") You will probably need to re-calculate the worksheet if you change cell colors because Excel may not realize the function colorcode will have to be re-executed. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extract 7 and 30 day max | Excel Discussion (Misc queries) | |||
How can I extract each Max key value ? | New Users to Excel | |||
Install dates formating using conditional formating? | Excel Discussion (Misc queries) | |||
Extract Unique Values, Then Extract Again to Remove Suffixes | Excel Discussion (Misc queries) |