Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Nested IF-Function fills multiple cells

0

Hello everyone, I'm facing a weird problem I've never faced before. I'm trying to use a simple, nested IF-function for ONE cell, but it applies to multiple cells which can't be removed. It works like that: (WENN = IF in German) 

=WENN(B26:B30="gering";"gering";

WENN(B26:B30="mittel";"mittel";

WENN(B26:B30="hoch";"hoch")))

It will apply to as many cells as I'm checking (B26:B30 = 5) 

I've attached the file. Formula is written in B32 and I want it to apply only in B32.

Thanks in advance!

Answer
Discuss

Discussion

Your condition WENN(B26:B30 = "gering", isn't clear. Do you mean, IF one of the said cells = "gering" or do you mean IF all of the said cells = "gering"? It may also be important to understand what you mean by "which can't be removed", which I don't. Please explain.
Variatus (rep: 4889) Feb 20, '21 at 6:31 am
Add to Discussion

Answers

0
Selected Answer

Hi

Your equation is an array formula, acting on a 5 cell array and producing a five cell array output (as you have found).

I suggest you wrap the OR function around each test (which produces a TRUE or FALSE result, like a normal IF, not an array) and then the result appears in just one cell.

In the attached file, I've done that by putting this in cell B32 of sheet Prozessbewertung:

{=IF(OR(B26:B30="gering"),"gering",IF(OR(B26:B30="mittel"),"mittel",IF(OR(B26:B30="hoch"),"hoch")))}
(entered with Ctrl+Shift+Enter, as you know).

Hope this is what you want.

Revision 1: Following the discussion point made by @Variatus, you may need to change the OR for AND (if that's the result you need)

Revision 2: I now realise that "hoch" is "high" (and "gering" is "low") so you probably want "hoch" as the result if any cell in B26:B30 rates "hoch" for "Komplexität" (complexity). Therefore I've put this alternative array equation in cell C32 of the revised file attached to swap the nested IF tests to suit:

{= IF(OR(B26:B30="hoch"),"hoch",IF(OR(B26:B30="mittel"),"mittel",IF(OR(B26:B30="gering"),"gering")))}
Please use which meets your needs.
Discuss

Discussion

Thank you guys so much! 

What I wanted idd was "If one of the cells say high > put it as high, if if the max value is medium, put it as medium and it the max value is low > put it as low!

Thanks John_Ru, your solution works perfectly fine. 

And thanky you Variatus aswell! 
zwergenheber (rep: 4) Feb 20, '21 at 7:32 am
Thanks, good to hear C32 worked.
John_Ru (rep: 6142) Feb 20, '21 at 7:41 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login