Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Changing cell color based on mathematical outcome

I have been tasked with setting up a QA program for large amounts of
data. I have a lot of experience with Excel but none with VBA and I
know that conditional formatting cannot be done with a formula.

Simple example:

Cell A1 = 100
Cell A2 = 180

Wanted outcome:

IF(ABS(A1-A2)<100,"MAKE THE CELL RED","MAKE THE CELL GREEN")
IF(ABS(A2-A3)<100...ETC.

I need to loop this situation through the entire spreadsheet, which
over the course of time will have a variable amount of rows (could be
upwards of 50,000).

Honestly, I don't even know where to start to write the first line of
code. I played around with some commands, but nothing really made
sense to me.

Thanks for any help you may provide!

Douglas

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing cell color based on mathematical outcome

in the conditional formatting dialog, change the first dropdown from Cell
Value is to Formula is, then you can put in your formula.

So you can use a formula with conditional formatting

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
I have been tasked with setting up a QA program for large amounts of
data. I have a lot of experience with Excel but none with VBA and I
know that conditional formatting cannot be done with a formula.

Simple example:

Cell A1 = 100
Cell A2 = 180

Wanted outcome:

IF(ABS(A1-A2)<100,"MAKE THE CELL RED","MAKE THE CELL GREEN")
IF(ABS(A2-A3)<100...ETC.

I need to loop this situation through the entire spreadsheet, which
over the course of time will have a variable amount of rows (could be
upwards of 50,000).

Honestly, I don't even know where to start to write the first line of
code. I played around with some commands, but nothing really made
sense to me.

Thanks for any help you may provide!

Douglas



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Changing cell color based on mathematical outcome

CF can be done with a formula.

Got to CF
Change condition 1 to Formula Is
Add a formula of ABS(A1-A2)<100
Set that to red
Add another condition
Use a formula of ABS(A1-A2)=100
set to green
OK


--
HTH

Bob Phillips

wrote in message
oups.com...
I have been tasked with setting up a QA program for large amounts of
data. I have a lot of experience with Excel but none with VBA and I
know that conditional formatting cannot be done with a formula.

Simple example:

Cell A1 = 100
Cell A2 = 180

Wanted outcome:

IF(ABS(A1-A2)<100,"MAKE THE CELL RED","MAKE THE CELL GREEN")
IF(ABS(A2-A3)<100...ETC.

I need to loop this situation through the entire spreadsheet, which
over the course of time will have a variable amount of rows (could be
upwards of 50,000).

Honestly, I don't even know where to start to write the first line of
code. I played around with some commands, but nothing really made
sense to me.

Thanks for any help you may provide!

Douglas



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Changing cell color based on mathematical outcome

Thanks guys and I appreciate the replies... but it's very hard
sometimes to clearly state what the problem might be...

What was described above turns the cell with the formula a specific
color... I want the formula (or VBA) to turn the cell with the actual
numbers (i.e. A1, A2) a color based on the critieria.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Changing cell color based on mathematical outcome

I think that that is what Tom and I were assuming in our replies. The
formulas and the result values are I presume in the same cell?

--
HTH

Bob Phillips

wrote in message
oups.com...
Thanks guys and I appreciate the replies... but it's very hard
sometimes to clearly state what the problem might be...

What was described above turns the cell with the formula a specific
color... I want the formula (or VBA) to turn the cell with the actual
numbers (i.e. A1, A2) a color based on the critieria.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Changing cell color based on mathematical outcome

unfortunately no...

I have ascii data that gets parsed and brought into Excel. Now I need
to analyze the data, so if I write a formula, it can't be in the same
cell as the results and I can't have extra cells... that's why i was
thinking macro... so something could run in the background and color
the cells with the raw data without creating cells with formulas.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Changing cell color based on mathematical outcome

You just reference the cell with the data in the formula. For instance in B1
you could use

=A1=10

and it returns a TRUE or FALSE that CF works on.


--
HTH

Bob Phillips

wrote in message
oups.com...
unfortunately no...

I have ascii data that gets parsed and brought into Excel. Now I need
to analyze the data, so if I write a formula, it can't be in the same
cell as the results and I can't have extra cells... that's why i was
thinking macro... so something could run in the background and color
the cells with the raw data without creating cells with formulas.



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
Changing Cell Color Based on Value DisMusBeDaPlaz Excel Worksheet Functions 2 December 31st 09 04:55 AM
Changing the font of a cell dependant on the outcome Bemused Scot Excel Worksheet Functions 1 September 25th 07 12:01 PM
Changing background color based on different cell djarcadian Excel Discussion (Misc queries) 3 August 10th 06 10:44 PM
Changing a cell color based on date entry ... T. Denford Excel Programming 6 April 14th 05 12:16 AM
Changing cell color based on its value spolk[_8_] Excel Programming 9 June 1st 04 08:24 AM


All times are GMT +1. The time now is 02:17 AM.

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"