SOLVED

Writing an IF Formula in Excel with multiple conditions over multiple cells

%3CLINGO-SUB%20id%3D%22lingo-sub-2595145%22%20slang%3D%22en-US%22%3EWriting%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595145%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20write%20an%20IF%20formula%20in%20excel%20that%20has%20multiple%20conditions%20from%20multiple%20cells.%3C%2FP%3E%3CP%3EColumns%20C%2C%20D%2C%20E%2C%20%26amp%3B%20F%20are%20conditional%20formatted%20so%20that%20if%20the%20value%20in%20each%20of%20them%20is%20%26lt%3B300%20the%20cell%20fills%20with%20a%20light%20green%20color%2C%20if%20the%20value%20is%20between%20301-700%20the%20cell%20fills%20with%20a%20yellow%20color%2C%20and%20if%20the%20value%20is%20%26gt%3B700%20the%20cell%20fills%20with%20an%20orange%20color.%26nbsp%3B%20Green%20fill%20color%20indicates%20the%20count%20is%20low%2C%20yellow%20fill%20color%20indicates%20the%20count%20is%20medium%2C%20and%20orange%20fill%20color%20indicates%20the%20count%20is%20high.%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20Column%20I%20am%20trying%20to%20write%20the%20IF%20formula%20into%20is%20Column%20G%20and%20I%20need%20it%20to%20put%20either%20the%20letter%20N%20or%20the%20letter%20Y%20(for%20No%20or%20Yes)%20into%20the%20cells%20of%20Column%20G%20depending%20on%20what%20the%20values%20in%20Columns%20C-F%20are.%26nbsp%3B%20If%20all%204%20cells%20(C-F)%20are%20each%20%26lt%3B300%20then%20the%20cells%20in%20Column%20G%20should%20be%20N%3C%2FP%3E%3CP%3EIf%20at%20least%202%20cells%20(C-F)%20are%20%26gt%3B300%20then%20the%20cells%20in%20Column%20G%20should%20be%20Y%3C%2FP%3E%3CP%3EI%20have%20written%20both%20an%20IF(AND)%20formula%3A%20IF((AND(C11%26gt%3B300%2CD11%26gt%3B300%2CE11%26gt%3B300%2CF11%26gt%3B300))%2C%22Y%22%2C%22N%22)%3C%2FP%3E%3CP%3Eas%20well%20as%20an%20IF(OR)%20formula%3A%26nbsp%3BIF((OR(C13%26gt%3B300%2CD13%26gt%3B300%2CE13%26gt%3B300%2CF13%26gt%3B300))%2C%22Y%22%2C%22N%22)%3C%2FP%3E%3CP%3EThe%20IF(AND)%20formula%20works%20correctly%20at%20putting%20the%20N%20value%20into%20the%20cells%20of%20Column%20G%20only%20if%20one%20or%20none%20of%20the%20cells%20(C-F)%20is%20above%20300%2C%20and%20will%20correctly%20put%20the%20Y%20value%20into%20the%20cells%20of%20Column%20G%20only%20if%20all%204%20cells%20(C-F)%20are%20above%20300.%26nbsp%3B%20However%2C%20if%202%20or%203%20of%20the%20cells%20(C-F)%20are%20above%20300%2C%20it%20incorrectly%20puts%20the%20letter%20N%20by%20using%20the%20IF(AND)%20formula%20as%20it%20is%20written.%3C%2FP%3E%3CP%3EThe%20IF(OR)%20formula%20works%20correctly%20at%20putting%20the%20Y%20value%20into%20the%20cells%20of%20Column%20G%20if%20two%20or%20more%20of%20the%20cells%20(C-F)%20are%20above%20300%20as%20well%20as%20correctly%20putting%20the%20N%20value%20into%20the%20cells%20of%20Column%20G%20only%20if%20all%204%20cells%20(C-F)%20are%20below%20300.%26nbsp%3B%20However%2C%20if%20only%20one%20of%20the%20cells%20(C-F)%20are%20above%20300%2C%20then%20if%20incorrectly%20puts%20the%20letter%20Y%20instead%20of%20the%20letter%20N%20by%20using%20the%20IF(OR)%20formula%20as%20it%20is%20written.%3C%2FP%3E%3CP%3ECan%20someone%20help%20me%20figure%20out%20how%20to%20correct%20this%20so%20that%20I%20only%20have%20to%20use%20one%20formula%20for%20all%20the%20cells%20in%20Column%20G%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2595145%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2596274%22%20slang%3D%22en-US%22%3ERe%3A%20Writing%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2596274%22%20slang%3D%22en-US%22%3EThank%20you%20Hans!!%20Something%20so%20small%20like%20that%20can%20easily%20be%20overlooked%20(as%20it%20obviously%20was%20by%20me%2C%20lol)...You've%20been%20a%20definite%20help!!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2595540%22%20slang%3D%22en-US%22%3ERe%3A%20Writing%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595540%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1115704%22%20target%3D%22_blank%22%3E%40MelissaHammond%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks.%20In%20the%20sample%20workbook%20in%20your%20first%20post%20in%20this%20thread%2C%20the%20data%20began%20in%20row%2010%2C%20so%20I%20posted%20a%20formula%20for%20row%2010.%3C%2FP%3E%0A%3CP%3EBut%20in%20your%20'real'%20workbook%2C%20the%20data%20begin%20in%20row%2011%2C%20but%20you%20still%20used%20the%20formula%20for%20row%2010.%20Hence%20the%20result%20referred%20to%20the%20wrong%20row.%3C%2FP%3E%0A%3CP%3ESee%20the%20attached%20version.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2595494%22%20slang%3D%22en-US%22%3ERe%3A%20Writing%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595494%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20a%20copy.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2595462%22%20slang%3D%22en-US%22%3ERe%3A%20Writing%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595462%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1115704%22%20target%3D%22_blank%22%3E%40MelissaHammond%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECould%20you%20attach%20a%20copy%20of%20your%20workbook%20instead%20of%20a%20screenshot%3F%20You%20can%20delete%20everything%20that%20is%20not%20relevant%20to%20the%20problem.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2595446%22%20slang%3D%22en-US%22%3ERe%3A%20Writing%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595446%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20understand%20either...in%20your%20example%2C%20it%20works%2C%20but%20when%20I%20applied%20it%20to%20mine%2C%20it%20did%20not.%3C%2FP%3E%3CP%3ECheck%20out%20the%20Screenshot%20I%20took.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2595430%22%20slang%3D%22en-US%22%3ERe%3A%20Writing%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595430%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1115704%22%20target%3D%22_blank%22%3E%40MelissaHammond%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20don't%20understand.%20See%20the%20screenshot%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S0629.png%22%20style%3D%22width%3A%20539px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299255i49F54F441DF07776%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22S0629.png%22%20alt%3D%22S0629.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2595177%22%20slang%3D%22en-US%22%3ERe%3A%20Writing%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595177%22%20slang%3D%22en-US%22%3EHey%20Hans%2C%20thanks%20for%20the%20reply%2C%20unfortunately%2C%20it%20didn't%20work%20correctly%20for%20all%20situations.%3CBR%20%2F%3EIt%20works%20correctly%20for%20when%20all%20cell%20values%20(C-F)%20are%20less%20than%20300%2C%20or%20if%20only%201%20of%20the%20cells%20(C-F)%20is%20above%20300%2C%20or%20if%20at%20least%203%20of%20the%20cells%20(C-F)%20are%20above%20300%2C%20but%20not%20when%202%20of%20the%20cells%20(C-F)%20are%20above%20300.%20However%2C%20if%20only%20two%20of%20the%20cells%20(C-F)%20have%20a%20value%20in%20them%20at%20all%20(example%3A%20C%20%3D%20100%2C%20and%20E%20%3D%20265%2C%20but%20there%20is%20no%20value%20in%20D%20or%20F)%20it%20put%20Y%20instead%20of%20N%2C%20and%20conversely%20(example%3A%20D%20%3D%20308%2C%20and%20F%20%3D%20482%2C%20but%20there%20is%20no%20value%20in%20C%20or%20E)%20it%20put%20N%20instead%20of%20Y.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2595155%22%20slang%3D%22en-US%22%3ERe%3A%20Writing%20an%20IF%20Formula%20in%20Excel%20with%20multiple%20conditions%20over%20multiple%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2595155%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1115704%22%20target%3D%22_blank%22%3E%40MelissaHammond%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20G10%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DIF(COUNTIF(C10%3AF10%2C%22%26gt%3B300%22)%26gt%3B%3D2%2C%22Y%22%2C%22N%22)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFill%20down.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I am trying to write an IF formula in excel that has multiple conditions from multiple cells.

Columns C, D, E, & F are conditional formatted so that if the value in each of them is <300 the cell fills with a light green color, if the value is between 301-700 the cell fills with a yellow color, and if the value is >700 the cell fills with an orange color.  Green fill color indicates the count is low, yellow fill color indicates the count is medium, and orange fill color indicates the count is high. 

The Column I am trying to write the IF formula into is Column G and I need it to put either the letter N or the letter Y (for No or Yes) into the cells of Column G depending on what the values in Columns C-F are.  If all 4 cells (C-F) are each <300 then the cells in Column G should be N

If at least 2 cells (C-F) are >300 then the cells in Column G should be Y

I have written both an IF(AND) formula: IF((AND(C11>300,D11>300,E11>300,F11>300)),"Y","N")

as well as an IF(OR) formula: IF((OR(C13>300,D13>300,E13>300,F13>300)),"Y","N")

The IF(AND) formula works correctly at putting the N value into the cells of Column G only if one or none of the cells (C-F) is above 300, and will correctly put the Y value into the cells of Column G only if all 4 cells (C-F) are above 300.  However, if 2 or 3 of the cells (C-F) are above 300, it incorrectly puts the letter N by using the IF(AND) formula as it is written.

The IF(OR) formula works correctly at putting the Y value into the cells of Column G if two or more of the cells (C-F) are above 300 as well as correctly putting the N value into the cells of Column G only if all 4 cells (C-F) are below 300.  However, if only one of the cells (C-F) are above 300, then if incorrectly puts the letter Y instead of the letter N by using the IF(OR) formula as it is written.

Can someone help me figure out how to correct this so that I only have to use one formula for all the cells in Column G? 

8 Replies

@MelissaHammond 

In G10:

 

=IF(COUNTIF(C10:F10,">300")>=2,"Y","N")

 

Fill down.

Hey Hans, thanks for the reply, unfortunately, it didn't work correctly for all situations.
It works correctly for when all cell values (C-F) are less than 300, or if only 1 of the cells (C-F) is above 300, or if at least 3 of the cells (C-F) are above 300, but not when 2 of the cells (C-F) are above 300. However, if only two of the cells (C-F) have a value in them at all (example: C = 100, and E = 265, but there is no value in D or F) it put Y instead of N, and conversely (example: D = 308, and F = 482, but there is no value in C or E) it put N instead of Y.

@MelissaHammond 

I don't understand. See the screenshot below:

S0629.png

@Hans Vogelaar 

 

I don't understand either...in your example, it works, but when I applied it to mine, it did not.

Check out the Screenshot I took.

@MelissaHammond 

Could you attach a copy of your workbook instead of a screenshot? You can delete everything that is not relevant to the problem.

@Hans Vogelaar 

 

Here is a copy.

 

best response confirmed by allyreckerman (Microsoft)
Solution

@MelissaHammond 

Thanks. In the sample workbook in your first post in this thread, the data began in row 10, so I posted a formula for row 10.

But in your 'real' workbook, the data begin in row 11, but you still used the formula for row 10. Hence the result referred to the wrong row.

See the attached version.

Thank you Hans!! Something so small like that can easily be overlooked (as it obviously was by me, lol)...You've been a definite help!!