SOLVED
Home

Complicated Programming Help (Tried using IF/Not/logical statements)

%3CLINGO-SUB%20id%3D%22lingo-sub-713626%22%20slang%3D%22en-US%22%3EComplicated%20Programming%20Help%20(Tried%20using%20IF%2FNot%2Flogical%20statements)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-713626%22%20slang%3D%22en-US%22%3E%3CP%3EHello!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20trying%20to%20create%20a%20program%20where%20specific%20combinations%20of%20%22TRUE%22%20values%20will%20output%20FOUR%20different%20responses%20(MBA%2C%20NA%2C%20XBA%2C%20and%20both).%20For%20instance%2C%20if%20JUST%20cells%20F3%20and%20F9%20are%20selected%20as%20%22TRUE%2C%22%20and%20the%20other%20cells%20are%20%22FALSE%22%20the%20output%20will%20be%20%22MBA.%22%20However%2C%20if%20cells%20F3%2C%20F9%2C%20and%20F10%20are%20selected%20as%20%22TRUE%2C%22%20the%20output%20will%20be%20NA.%20Furthermore%2C%20if%20JUST%20cells%20G3%20and%20G4%20are%20%22TRUE%2C%22%20the%20output%20will%20be%20%22XBA%2C%22%20and%20if%20JUST%20cells%20F9%20and%20F10%20are%20selected%2C%20the%20output%20will%20be%20%22both.%22%20Etc...%2C%20there%20are%20multiple%20combinations%20that%20I%20hope%20to%20program%20into%20four%20different%20outputs.%20Do%20you%20have%20any%20suggestions%20as%20to%20how%20I%20should%20do%20this%3F%20I%20have%20tried%20using%20if%2Fnot%20statements%3B%20however%2C%20the%20code%20gets%20messy%20quickly.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20time!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-713626%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-713664%22%20slang%3D%22en-US%22%3ERe%3A%20Complicated%20Programming%20Help%20(Tried%20using%20IF%2FNot%2Flogical%20statements)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-713664%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F364500%22%20target%3D%22_blank%22%3E%40shia1700%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETry%20this%20formula%20out%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(AND(F3%3DTRUE%2CF9%3DTRUE%2CF4%3AF8%3DFALSE%2CF10%3AF11%3DFALSE%2CG3%3AG10%3DFALSE)%2C%22MBA%22%2CIF(AND(F3%3DTRUE%2CF9%3DTRUE%2CF10%3DTRUE%2CF4%3AF8%3DFALSE%2CF11%3DFALSE%2CG3%3AG10%3DFALSE)%2C%22NA%22%2CIF(AND(G3%3AG4%3DTRUE%2CF3%3AF11%3DFALSE%2CG5%3AG10%3DFALSE)%2C%22XBA%22%2CIF(AND(F9%3AF10%3DTRUE%2CF3%3AF8%3DFALSE%2CG3%3AG10%3DFALSE)%2C%22both%22%2C%22NO%20RESULT%22))))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20an%20array%20formula%20so%20you%20will%20have%20to%20press%20ctrl%2Bshift%2Benter.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-728148%22%20slang%3D%22en-US%22%3ERe%3A%20Complicated%20Programming%20Help%20(Tried%20using%20IF%2FNot%2Flogical%20statements)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-728148%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20so%20much!%20I%20had%20no%20clue%20that%20we%20had%20to%20press%20control%2Bshift%2Benter%20for%20array%20formulas!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-729557%22%20slang%3D%22en-US%22%3ERe%3A%20Complicated%20Programming%20Help%20(Tried%20using%20IF%2FNot%2Flogical%20statements)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-729557%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20a%20variant%3C%2FP%3E%0A%3CPRE%3E%3DSWITCH(SUMPRODUCT((F3%3AF11%2BG3%3AG11*10)*(ROW(F3%3AF11)-ROW(%24F%242)))%2C8%2C%22MBA%22%2C16%2C%22NA%22%2C30%2C%22XBA%22%2C15%2C%22both%22%2C%22%22)%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
shia1700
New Contributor

Hello!

 

I'm trying to create a program where specific combinations of "TRUE" values will output FOUR different responses (MBA, NA, XBA, and both). For instance, if JUST cells F3 and F9 are selected as "TRUE," and the other cells are "FALSE" the output will be "MBA." However, if cells F3, F9, and F10 are selected as "TRUE," the output will be NA. Furthermore, if JUST cells G3 and G4 are "TRUE," the output will be "XBA," and if JUST cells F9 and F10 are selected, the output will be "both." Etc..., there are multiple combinations that I hope to program into four different outputs. Do you have any suggestions as to how I should do this? I have tried using if/not statements; however, the code gets messy quickly. 

 

Thanks for your time!

3 Replies
Solution

Hello @shia1700,

 

Try this formula out:

 

=IF(AND(F3=TRUE,F9=TRUE,F4:F8=FALSE,F10:F11=FALSE,G3:G10=FALSE),"MBA",IF(AND(F3=TRUE,F9=TRUE,F10=TRUE,F4:F8=FALSE,F11=FALSE,G3:G10=FALSE),"NA",IF(AND(G3:G4=TRUE,F3:F11=FALSE,G5:G10=FALSE),"XBA",IF(AND(F9:F10=TRUE,F3:F8=FALSE,G3:G10=FALSE),"both","NO RESULT"))))

 

This is an array formula so you will have to press ctrl+shift+enter.

 

Hope this helps! 

Thank you so much! I had no clue that we had to press control+shift+enter for array formulas! 

As a variant

=SWITCH(SUMPRODUCT((F3:F11+G3:G11*10)*(ROW(F3:F11)-ROW($F$2))),8,"MBA",16,"NA",30,"XBA",15,"both","")
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
description for autoplay blocking in settings page
HotCakeX in Discussions on
8 Replies