SOLVED

how to create a function that uses two colour criteria to generate text

%3CLINGO-SUB%20id%3D%22lingo-sub-2332632%22%20slang%3D%22en-US%22%3Ehow%20to%20create%20a%20function%20that%20uses%20two%20colour%20criteria%20to%20generate%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2332632%22%20slang%3D%22en-US%22%3E%3CP%3EHi!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20help%20creating%20a%20function%20that%20returns%20text%20by%20giving%20a%20combination%20of%20two%20colors.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%2C%20if%20I%20pick%20two%20cells%2C%20one%20red%20and%20one%20green%2C%20I%20want%20to%20get%20BAD.%20If%20both%20cells%20are%20green%2C%20then%20I%20want%20to%20get%20GOOD.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20anyone%20help%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Capturar_EXCEL.JPG%22%20style%3D%22width%3A%20984px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F278869i84A401EFC5984C13%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capturar_EXCEL.JPG%22%20alt%3D%22Capturar_EXCEL.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2332632%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2332684%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20create%20a%20function%20that%20uses%20two%20colour%20criteria%20to%20generate%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2332684%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1047245%22%20target%3D%22_blank%22%3E%40aigr_pt%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAre%20the%20colors%20set%20manually%20or%20are%20they%20the%20result%20of%20conditional%20formatting%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2332688%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20create%20a%20function%20that%20uses%20two%20colour%20criteria%20to%20generate%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2332688%22%20slang%3D%22en-US%22%3EHi%20there!%3CBR%20%2F%3EThey%20resolt%20from%20condicional%20formatting%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2332808%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20create%20a%20function%20that%20uses%20two%20colour%20criteria%20to%20generate%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2332808%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1047245%22%20target%3D%22_blank%22%3E%40aigr_pt%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20so%20you%20don't%20need%20VBA%20to%20pick-up%20colors%2C%20logic%20of%20conditional%20formatting%20could%20be%20used%20in%20formula.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2332914%22%20slang%3D%22en-US%22%3ERe%3A%20how%20to%20create%20a%20function%20that%20uses%20two%20colour%20criteria%20to%20generate%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2332914%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1047245%22%20target%3D%22_blank%22%3E%40aigr_pt%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EWhat%20Sergei%20writes...%3C%2FP%3E%0A%3CP%3ELet's%20say%20a%20cell%20is%20green%20if%20the%20value%20is%20%26gt%3B%3D5%20and%20red%20if%20it%20is%20%26lt%3B5%3C%2FP%3E%0A%3CP%3EYou%20can%20use%20the%20formula%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DIF(AND(cell1%26gt%3B%3D5%2C%20cell2%26gt%3B%3D5)%2C%20%22GOOD%22%2C%20%22BAD%22)%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi!

 

I need help creating a function that returns text by giving a combination of two colors.

 

For example, if I pick two cells, one red and one green, I want to get BAD. If both cells are green, then I want to get GOOD.

 

Can anyone help?

 

Thanks

 

Capturar_EXCEL.JPG

7 Replies

@aigr_pt 

Are the colors set manually or are they the result of conditional formatting?

Hi there!
They resolt from condicional formatting

@aigr_pt 

If so you don't need VBA to pick-up colors, logic of conditional formatting could be used in formula.

best response confirmed by allyreckerman (Microsoft)
Solution

@aigr_pt

What Sergei writes...

Let's say a cell is green if the value is >=5 and red if it is <5

You can use the formula

 

=IF(AND(cell1>=5, cell2>=5), "GOOD", "BAD")

@aigr_pt 

1) What are the conditional formatting rules?

2) Which cells do you want to look at?

Sorry! My mistake!!! It works!!! Thank you so much!