Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Extract value from formating

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Extract value from formating

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Extract value from formating

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Extract value from formating

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Extract value from formating

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Extract value from formating

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract 7 and 30 day max West22 Excel Discussion (Misc queries) 2 December 5th 07 12:55 AM
How can I extract each Max key value ? diglas1 via OfficeKB.com New Users to Excel 2 May 31st 06 11:06 PM
Install dates formating using conditional formating? Jerry Eggleston Excel Discussion (Misc queries) 2 November 9th 05 05:49 PM
Extract Unique Values, Then Extract Again to Remove Suffixes Karl Burrows Excel Discussion (Misc queries) 23 June 25th 05 10:37 PM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"