SOLVED

LOGICAL FORMULA fail..!!!!

%3CLINGO-SUB%20id%3D%22lingo-sub-2948860%22%20slang%3D%22en-US%22%3ELOGICAL%20FORMULA%20fail..!!!!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2948860%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20guys%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20theory%2C%20a%20fairly%20simple%20task%20but%20I%20just%20can't%20figure%20out%20how%20to%20write%20the%20formula%20correctly%20(yes%2C%20a%20bit%20of%20an%20Excel%20doofus%2C%20apologies)!%20If%20you%20can%20help%2C%20I'll%20be%20hugely%20grateful.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBasically%2C%20just%20want%20to%20combine%20two%20IF's%20to%20produce%20a%20result%2C%20hence%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20the%20text%20in%20cell%20A2%20says%20one%20thing%20and%20the%20text%20in%20cell%20B2%20says%20another%20thing%2C%20then%20the%20resulting%20text%20in%20cell%20C2%20will%20be%20the%20final%20thing.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMultiple%20possible%20permutations%20as%20you%20can%20see%20in%20the%20attached%20file%20but%20even%20so%2C%20you%20think%20I'd%20be%20able%20to%20get%20that%20right%20but%20noooooo...%20%3CLI-EMOJI%20id%3D%22lia_disappointed-face%22%20title%3D%22%3Adisappointed_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20save%20my%20sanity.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers.%3C%2FP%3E%3CP%3EGyp%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2948860%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2949004%22%20slang%3D%22en-US%22%3ERe%3A%20LOGICAL%20FORMULA%20fail..!!!!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2949004%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1214306%22%20target%3D%22_blank%22%3E%40Gypseyman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DVLOOKUP(D6%26amp%3BF6%2CCHOOSE(%7B1%2C2%7D%2C%24D%246%3A%24D%2420%26amp%3B%24F%246%3A%24F%2420%2C%24H%246%3A%24H%2420)%2C2%2C0)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20entered%20formula%20as%20array%20with%20ctrl%2Bshift%2Benter%20as%20i%20don't%20work%20with%20Office365%20or%202021.%20I%20understand%20that%20this%20might%20be%20the%20formula%20you%20are%20looking%20for.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2954144%22%20slang%3D%22en-US%22%3ERe%3A%20LOGICAL%20FORMULA%20fail..!!!!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2954144%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1214306%22%20target%3D%22_blank%22%3E%40Gypseyman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DVLOOKUP(K6%26amp%3BL6%2CCHOOSE(%7B1%2C2%7D%2C%24D%246%3A%24D%2420%26amp%3B%24F%246%3A%24F%2420%2C%24H%246%3A%24H%2420)%2C2%2C0)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20entered%20this%20formula%20in%20cell%20J6%20as%20arrayformula%20with%20ctrl%2Bshift%2Benter.%20Search%20values%20have%20to%20be%20entered%20in%20cells%26nbsp%3BK6%26amp%3BL6%20and%20result%20is%20returned%20in%20J6.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAn%20alternative%20would%20be%20a%20nested%20formula%20like%20the%20one%20i%20entered%20in%20cell%20D32.%20Search%20values%20are%20in%20cell%20D30%20and%20E30%20in%20this%20example.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(AND(D30%3D%24D%246%2CE30%3D%24F%246)%2C%24H%246%2CIF(AND(D30%3D%24D%247%2CE30%3D%24F%247)%2C%24H%247%2CIF(AND(D30%3D%24D%248%2CE30%3D%24F%248)%2C%24H%248%2CIF(AND(D30%3D%24D%249%2CE30%3D%24F%249)%2C%24H%249%2CIF(AND(D30%3D%24D%2410%2CE30%3D%24F%2410)%2C%24H%2410%2CIF(AND(D30%3D%24D%2411%2CE30%3D%24F%2411)%2C%24H%2411%2CIF(AND(D30%3D%24D%2412%2CE30%3D%24F%2412)%2C%24H%2412%2CIF(AND(D30%3D%24D%2413%2CE30%3D%24F%2413)%2C%24H%2413%2CIF(AND(D30%3D%24D%2414%2CE30%3D%24F%2414)%2C%24H%2414%2CIF(AND(D30%3D%24D%2415%2CE30%3D%24F%2415)%2C%24H%2415%2CIF(AND(D30%3D%24D%2416%2CE30%3D%24F%2416)%2C%24H%2416%2CIF(AND(D30%3D%24D%2417%2CE30%3D%24F%2417)%2C%24H%2417%2CIF(AND(D30%3D%24D%2418%2CE30%3D%24F%2418)%2C%24H%2418%2CIF(AND(D30%3D%24D%2419%2CE30%3D%24F%2419)%2C%24H%2419%2CIF(AND(D30%3D%24D%2420%2CE30%3D%24F%2420)%2C%24H%2420%2C%22%22)))))))))))))))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2954729%22%20slang%3D%22en-US%22%3ERe%3A%20LOGICAL%20FORMULA%20fail..!!!!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2954729%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20QP%2C%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20some%20reason%2C%20when%20I%20open%20the%20file%20you%20sent%20and%20click%20on%20the%20cell%20J6%20containing%20the%20formula%2C%20(even%20if%20only%20to%20look%20at%20it)%2C%20as%20soon%20as%20I%20click%20away%20from%20it%2C%20the%20text%20within%20the%20cell%20changes%20from%20MAINTAIN%20to%20%23N%2FA...%20I've%20tried%20removing%20the%20parentheses%20on%20the%20formula%20and%20then%20restoring%20them%20but%20that%20results%20in%20the%20actual%20formula%20showing%20as%20text%20in%20the%20cell.%20Rather%20strange...%3CBR%20%2F%3E%3CBR%20%2F%3EOn%20a%20positive%20note%2C%20however%2C%20the%20nested%20formula%20seems%20to%20work%20perfectly%20so%20I%20intend%20to%20go%20with%20that.%20Thanks%20so%20much!!!%20You%20have%20been%20a%20massive%20help%20and%20I%20really%20appreciate%20it%2C%20truly.%3CBR%20%2F%3E%3CBR%20%2F%3ECheers%20and%20thanks%20again.%3CBR%20%2F%3EGyp.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2955238%22%20slang%3D%22en-US%22%3ERe%3A%20LOGICAL%20FORMULA%20fail..!!!!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2955238%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1214306%22%20target%3D%22_blank%22%3E%40Gypseyman%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExcel%20365%20with%20Power%20Query.%3C%2FP%3E%3CP%3ERank%20with%202%20criteria.%3C%2FP%3E%3CP%3ENo%20formulas%2C%20no%20VBA%20macro.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.mediafire.com%2Ffile%2Fddn365st1ce6uev%2F11_11_21.xlsx%2Ffile%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.mediafire.com%2Ffile%2Fddn365st1ce6uev%2F11_11_21.xlsx%2Ffile%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.mediafire.com%2Ffile%2F646jr90zd62bkrd%2F11_11_21.pdf%2Ffile%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.mediafire.com%2Ffile%2F646jr90zd62bkrd%2F11_11_21.pdf%2Ffile%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi guys,

 

In theory, a fairly simple task but I just can't figure out how to write the formula correctly (yes, a bit of an Excel doofus, apologies)! If you can help, I'll be hugely grateful.

 

Basically, just want to combine two IF's to produce a result, hence:

 

If the text in cell A2 says one thing and the text in cell B2 says another thing, then the resulting text in cell C2 will be the final thing. 

 

Multiple possible permutations as you can see in the attached file but even so, you think I'd be able to get that right but noooooo...

 

Please save my sanity.

 

Cheers.

Gyp

4 Replies
best response confirmed by Gypseyman (New Contributor)
Solution

@Gypseyman 

=VLOOKUP(K6&L6,CHOOSE({1,2},$D$6:$D$20&$F$6:$F$20,$H$6:$H$20),2,0)

 

I entered this formula in cell J6 as arrayformula with ctrl+shift+enter. Search values have to be entered in cells K6&L6 and result is returned in J6.

 

An alternative would be a nested formula like the one i entered in cell D32. Search values are in cell D30 and E30 in this example.

 

=IF(AND(D30=$D$6,E30=$F$6),$H$6,IF(AND(D30=$D$7,E30=$F$7),$H$7,IF(AND(D30=$D$8,E30=$F$8),$H$8,IF(AND(D30=$D$9,E30=$F$9),$H$9,IF(AND(D30=$D$10,E30=$F$10),$H$10,IF(AND(D30=$D$11,E30=$F$11),$H$11,IF(AND(D30=$D$12,E30=$F$12),$H$12,IF(AND(D30=$D$13,E30=$F$13),$H$13,IF(AND(D30=$D$14,E30=$F$14),$H$14,IF(AND(D30=$D$15,E30=$F$15),$H$15,IF(AND(D30=$D$16,E30=$F$16),$H$16,IF(AND(D30=$D$17,E30=$F$17),$H$17,IF(AND(D30=$D$18,E30=$F$18),$H$18,IF(AND(D30=$D$19,E30=$F$19),$H$19,IF(AND(D30=$D$20,E30=$F$20),$H$20,"")))))))))))))))

Hi QP,

For some reason, when I open the file you sent and click on the cell J6 containing the formula, (even if only to look at it), as soon as I click away from it, the text within the cell changes from MAINTAIN to #N/A... I've tried removing the parentheses on the formula and then restoring them but that results in the actual formula showing as text in the cell. Rather strange...

On a positive note, however, the nested formula seems to work perfectly so I intend to go with that. Thanks so much!!! You have been a massive help and I really appreciate it, truly.

Cheers and thanks again.
Gyp.

@Gypseyman 

I'm glad my solution is helpful.

 

The VLOOKUP formula is an arrayformula that has to be entered with ctrl+shift+enter. If this formula is shown only as text, click in the formula bar and then press ctrl+shift+enter (in this order and press all of them) and this will put the { } around the formula and the formula will work (again). The { } can't be entered manually.

 

If you click in cell J6 then instead of clicking in another cell you can click on the red cross to the left of the formula bar. This will maintain the arrayformula. In attached file you can see the red cross on the upper left side. I added an blue arrow to indicate where to click.