PC Review


Reply
Thread Tools Rate Thread

create a formula based on cell color

 
 
pcwolfie
Guest
Posts: n/a
 
      23rd Aug 2008
Hi,

I was wondering if there was a formula to add up cells based on the cell
color? These cells have names in them and no numbers

For example:

Column A Column B
white cell yellow cell
white cell white cell
yellow cell yellow cell

I need the cells that are yellow to equal 25 and the cells with no color to
equal 45.

This spreadsheet is to total the pay for about 100 people and the yellow
cells are not all in a column.

Is there a formula along the lines of: if a person's name is in a yellow
cell, then the dollar amount associated with the cell = 25

Sorry this is so long, I wasn't sure how else to explain it.

Thanks for the help,

Laura
 
Reply With Quote
 
 
 
 
igorek
Guest
Posts: n/a
 
      23rd Aug 2008
Laura,

there are very nice tools out there that you may want to download that will
help your daily routines.
Your problem can be solved by a VBA code were you would use :
If cells's interior color = yellow (index here) then ajacent cell = 25

If you do not know VBA, get asap-utilities and this will do 95% you the job.

Igor



"pcwolfie" wrote:

> Hi,
>
> I was wondering if there was a formula to add up cells based on the cell
> color? These cells have names in them and no numbers
>
> For example:
>
> Column A Column B
> white cell yellow cell
> white cell white cell
> yellow cell yellow cell
>
> I need the cells that are yellow to equal 25 and the cells with no color to
> equal 45.
>
> This spreadsheet is to total the pay for about 100 people and the yellow
> cells are not all in a column.
>
> Is there a formula along the lines of: if a person's name is in a yellow
> cell, then the dollar amount associated with the cell = 25
>
> Sorry this is so long, I wasn't sure how else to explain it.
>
> Thanks for the help,
>
> Laura

 
Reply With Quote
 
ShaneDevenshire
Guest
Posts: n/a
 
      23rd Aug 2008
Hi,

Add the following VBA code to a module in the Visual Basic Editor of your
workbook:

Function CountOfColors(myRange As Range, myCell As Range) As Long
Dim Counter As Integer
Dim cell As Range
Counter = 0
For Each cell In myRange
If cell.Interior.ColorIndex = myCell.Interior.ColorIndex Then
Counter = Counter + 1
End If
Next cell
CountOfColors = 25 * Counter
End Function

Suppose that the cells that you want to check are in the range A110, then
in a cell outside this range color one of the cells whatever color the cells
are that you want to find, in your example some shade of yellow. Suppose
that the cell you color is F1, then you can enter the following formula in a
cell:

=countofcolors(A110,F1)

The beauty of this function is that it can work for any color.

--
Cheers,
Shane Devenshire


"pcwolfie" wrote:

> Hi,
>
> I was wondering if there was a formula to add up cells based on the cell
> color? These cells have names in them and no numbers
>
> For example:
>
> Column A Column B
> white cell yellow cell
> white cell white cell
> yellow cell yellow cell
>
> I need the cells that are yellow to equal 25 and the cells with no color to
> equal 45.
>
> This spreadsheet is to total the pay for about 100 people and the yellow
> cells are not all in a column.
>
> Is there a formula along the lines of: if a person's name is in a yellow
> cell, then the dollar amount associated with the cell = 25
>
> Sorry this is so long, I wasn't sure how else to explain it.
>
> Thanks for the help,
>
> Laura

 
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
RE: Formula to populate data in a cell based on another cell's color Luke M Microsoft Excel Misc 0 6th Feb 2009 04:12 PM
Formula to populate data in a cell based on another cell's color Cassie Microsoft Excel Misc 0 6th Feb 2009 03:28 PM
Add Cell range based on color of cell to existing formula =?Utf-8?B?SnVsIGluIE9oaW8=?= Microsoft Excel Programming 2 30th Jul 2007 02:18 PM
formula based on cell's color format bob Microsoft Excel Worksheet Functions 2 25th Aug 2004 05:15 AM
Conditional color based on formula in cell Ron Gommers Microsoft Excel Worksheet Functions 1 12th Nov 2003 02:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:19 PM.