Formula

G

gsaenz

Can Excel formulas read cell colors? Example: My wife wants to set up
spreadsheet for paying bills. When a bill is payed of we can turn i
green. At the bottom I have a total paid and a to pay cell. Can I writ
a formula that will only read a certain colors
 
R

Robert Rosenberg

Formulas cannot look to a cells color. What you can do is have a separate
column with (maybe) the phrase "PAID" in it next to each paid bill. You can
then use a SUMIF formula to get a total of all paid bills.

For ex:

=SUMIF(G5:G100,"PAID",D5:D100)

Where:

G5:G100 = the range containing possible word PAID
"PAID" = the phrase in G5:G100 that denotes paid bills
D5:D100 = range containing the bill amounts

Similarly, you can get a total of unpaid bills using the following SUMIF
formula

=SUMIF(G5:G100,"<>PAID",D5:D100)

Where the <> means not equal to

Finally, you can use the Format-->Conditional Formatting command to
automatcially apply your green colors when each bill is paid:

1. Select all of the cells you want to turn green when the bills are paid
In my example, the bills start in row 5
2. Click Format-->Conditional formatting
3. Change the first dropdown (on the left) to "Formula Is"
4. Enter the following formula in the textbox to the right of "Formula Is":

=$G5="PAID"

Where:
$G5 = the cell on the first row of your bills that may/may not
contain the word "PAID"
"PAID" = the word in that cell that will make the font color change.
Make
sure you place the word in quotes.

5. Click the Format button and on the Font Tab change the font color as
desired
6. Click OK twice
 
B

Bob Phillips

Custom formulas can read colours. See this previous post of mine
http://tinyurl.com/ydhj

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

Arvi Laanemets

Hi

There is always an option to write your own function, which reads cell
color. An example:
Public Function CellColor(MyCell As Range) As Integer
Application.Volatile
CellColor = MyCell.Interior.ColorIndex
End Function

The only problem - changing cell color doesn't fire the function
immediately. You have to enter something into sheet, or activate the formula
and then press Enter, or simply press F9


--
(Don't use my reply address - it's spam-trap)

Arvi Laanemets


Robert Rosenberg said:
Formulas cannot look to a cells color. What you can do is have a separate
column with (maybe) the phrase "PAID" in it next to each paid bill. You can
then use a SUMIF formula to get a total of all paid bills.

For ex:

=SUMIF(G5:G100,"PAID",D5:D100)

Where:

G5:G100 = the range containing possible word PAID
"PAID" = the phrase in G5:G100 that denotes paid bills
D5:D100 = range containing the bill amounts

Similarly, you can get a total of unpaid bills using the following SUMIF
formula

=SUMIF(G5:G100,"<>PAID",D5:D100)

Where the <> means not equal to

Finally, you can use the Format-->Conditional Formatting command to
automatcially apply your green colors when each bill is paid:

1. Select all of the cells you want to turn green when the bills are paid
In my example, the bills start in row 5
2. Click Format-->Conditional formatting
3. Change the first dropdown (on the left) to "Formula Is"
4. Enter the following formula in the textbox to the right of "Formula Is":

=$G5="PAID"

Where:
$G5 = the cell on the first row of your bills that may/may not
contain the word "PAID"
"PAID" = the word in that cell that will make the font color change.
Make
sure you place the word in quotes.

5. Click the Format button and on the Font Tab change the font color as
desired
6. Click OK twice
 
D

David McRitchie

It would be much better to have a column indicate that a bill is paid
than to use a function to pick up the color of a cell.

But if you must do it by looking at the color, and keep in mind
the computer can see differences in color that humans can't see.
Chip Pearson's "Functions For Cell Colors".
http://www.cpearson.com/excel/colors.htm

Some examples using those functions can be found on my
Color Palette and the 56 Excel ColorIndex Colors
http://www.mvps.org/dmcritchie/excel/colors.htm
 
D

David McRitchie

I never liked those make a shorter link or tinyurl because you add
another layer of problems to availability. After three minutes I
guess it is stuck just like the last four I tried to use today which came
up as invalid. Since it
is probably going to link to the Google Groups archives why not
just include that link to get directly there. Google has faster access
than most other sites, why risk going through an intermediary that
could add more advertising or worse when there is a direct approach
available. Don't know if this is what you mean, but this is one of yours.
http://google.com/[email protected]

Most replies would reference Chip Pearson's page.as did my reply in this thread.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm



Bob Phillips said:
Custom formulas can read colours. See this previous post of mine
http://tinyurl.com/ydhj

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
G

gsaenz

mhh thanks for the reply's. I think I am going to try the colum with
paid and unpaid. it seems to me the least amount of coding to do. I am
going to try that now.

thanks again
 
G

gsaenz

Well I got it figured out I think what I am going to do is using th
formula above (=SUMIF(H5:H12,"<>",D5:D12) I can get the toal amoun
paid, then I can take that from the toal due. I am going to use thi
unless someone has something better
 
D

Don Guillett

If the sums paid are in col G and the date paid is in col F, I would use
this to stop the "dreaded space bar" from giving a false report of paid.

=SUMIF(F5:F8,">0",G5:G8)
 
B

Bob Phillips

Yeah there was a problem yesterday, but that is the first time I have
experienced it in all the time I have used it, can't say the same of Google.

My Goggle references are not as short as your. My previous post that you
refer to as
http://google.com/[email protected]
(which is not the post that I refer to by the way), comes up as
http://www.google.com/groups?hl=en&...s&as_uauthors=Bob%20Phillips&lr=lang_en&hl=en
when I look it up in Google, so I think you can see why I use TinyUrl.

As to my reference, my post is a more specific, but better, example (IMO)
that Harlan and I developed and which fits the question.

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top