Combining IF(AND

%3CLINGO-SUB%20id%3D%22lingo-sub-1548917%22%20slang%3D%22en-US%22%3ECombining%20IF(AND%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1548917%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20two%20statements%20that%20by%20themselves%20work.%26nbsp%3B%20I%20need%20to%20combine%20them%20to%20look%20for%20both%20and%20return%20APRON%20XL%20%26amp%3B%20NITRAGIN%20GOLD%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EAPRON%20BY%20ITSELF%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3DIFERROR(IF('NEW%20OFFICE%20COPY'!%24D%245%3DFALSE%2C%22%22%2CIF(INDEX('Product%20List'!%24A%242%3A%24BY%241003%2CMATCH('NEW%20OFFICE%20COPY'!%24C%246%2C'Product%20List'!%24D%242%3A%24D%241003%2C0)%2CMATCH('NEW%20OFFICE%20COPY'!%24K%247%2C'Product%20List'!%24A%241%3A%24BY%241%2C0))%3D%22YES%22%2C%22%22))%2C%22APRON%20XL%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ENITRAGIN%20GOLD%20BY%20ITSELF%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3DIFERROR(IF('NEW%20OFFICE%20COPY'!%24D%245%3DFALSE%2C%E2%80%9D%E2%80%9D%2CIF(INDEX('Product%20List'!%24A%242%3A%24BY%241003%2CMATCH('NEW%20OFFICE%20COPY'!%24C%246%2C'Product%20List'!%24D%242%3A%24D%241003%2C0)%2CMATCH('NEW%20OFFICE%20COPY'!%24K%249%2C'Product%20List'!%24A%241%3A%24BY%241%2C0))%3D%22X%22%2C%E2%80%9D%E2%80%9D))%2C%22NITRAGIN%20GOLD%22)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1548917%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-1550090%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF(AND%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1550090%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F399870%22%20target%3D%22_blank%22%3E%40kdwork%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20would%20be%20easier%20to%20help%20you%20if%20you%20helped%20us%20by%20posting%20a%20copy%20of%20your%20actual%20spreadsheet.%20With%20just%20the%20formulas%2C%20you're%20asking%20(no%2C%20%3CSTRONG%3E%22forcing%22%3C%2FSTRONG%3E)%20your%20reader%20to%20visualize%20the%20tables%20that%20you're%20referring%20to%20in%20your%20MATCH%20functions%2C%20among%20other%20things.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20aside%2C%20it%20may%20well%20be%20that%20the%20IFS%20function%20would%20be%20more%20suitable%20than%20a%20really%20complex%20combination%20of%20these%20two%20already-difficult-to-decipher%20formulas.%20With%20IFS%20you%20can%20specify%2C%20sequentially%2C%20condition%2Bresult%20pairings%20that%20satisfy%20various%20combinations%20of%20conditions.%20Here's%20the%20syntax%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DIFS%20(test1%2C%20value1%2C%20%5Btest2%2C%20value2%5D%2C%20...)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20clearly%20know%20how%20to%20write%20formulas%2C%20so%20you%20might%20want%20to%20give%20that%20a%20try.%20If%20you%20need%20further%20help%2C%20though%2C%20I'd%20recommend%20posting%20a%20copy%20of%20the%20workbook%20you're%20working%20with%2C%20so%20long%20as%20it%20contains%20no%20confidential%20information.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1551020%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF(AND%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1551020%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F399870%22%20target%3D%22_blank%22%3E%40kdwork%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attached%20a%20sample%20copy%20of%20the%20file.%26nbsp%3B%20On%20the%20Pallet%20Label%20tab%20is%20where%20I%20am%20trying%20to%20use%20the%20formula.%26nbsp%3B%20You%20will%20see%20my%20two%20test%20formulas%20for%20the%20two%20separately.%26nbsp%3B%20Ultimately%20the%20combination%20of%20the%20two%20will%20appear%20in%20the%20B2%3AO2%20when%26nbsp%3BD5%20on%20the%20New%20Office%20Copy%20is%20TRUE.%26nbsp%3B%20The%20formula%20that%20is%20currently%20in%20that%20box%20will%20need%20to%20be%20what%20shows%20when%20D5%20on%20the%20New%20Office%20Copy%20tab%20is%20FALSE.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20open%20to%20other%20options%20if%20there%20is%20something%20that%20will%20work%20better.%26nbsp%3B%20The%20current%20formulas%20were%20because%20on%20occasion%20there%20may%20be%20the%20same%20Variety%20name%20that%20is%20used%20in%20more%20than%20one%20Brand%20and%20it%20needs%20to%20pull%20in%20the%20correct%20item%23%2FGTIN%23%20and%20bagging%20info.%26nbsp%3B%20I%20am%20really%20not%20very%20familiar%20with%20formulas%2C%20just%20good%20at%20copying%2Fediting%20from%20other%20spreadsheets%2C%20internet%20lookup%20and%20trial%20and%20error.%26nbsp%3B%20However%20this%20one%20I%20haven't%20been%20able%20to%20get%20to%20work%20because%20of%20the%20if%20False%2FTrue%20variable%20and%20where%20the%20IF%2FAND%20should%20go.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1551119%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF(AND%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1551119%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F399870%22%20target%3D%22_blank%22%3E%40kdwork%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20sorry%2C%20but%20that%20workbook%20is%20not%20one%20that%20I%20can%20afford%20the%20time%20to%20decode%2Fdecipher.%20There's%20so%20much%20there%20I'd%20want%20to%20change%20to%20take%20better%20advantage%20of%20Excel.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20sure%20that%20you%20are%20very%20clear%20in%20your%20own%20mind%20on%20what%20you're%20asking.%20But%20the%20reality%20is%20that%20it's%20clear%20to%20you%20because%20phrases%20like%20%3CEM%3E%22%20there%20may%20be%20the%20same%20Variety%20name%20that%20is%20used%20in%20more%20than%20one%20Brand%20and%20it%20needs%20to%20pull%20in%20the%20correct%20item%23%2FGTIN%23%20and%20bagging%20info%22%3C%2FEM%3E%20are%20intelligible%20to%20you.%20You%20know%20what%20each%20word%20refers%20to%20in%20that%20phrase.%20I%20don't.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20%22product%20list%22%20tab%20bears%20some%20resemblance%20to%20a%20legitimate%20Excel%20Table%2C%20but%20the%20blank%20rows%20are%20artifacts%20of%20a%20human%20attempt%20to%20make%20it%20more%20readable%20to%20humans%3B%20in%20the%20process%20making%20it%20less%20amenable%20to%20computer%20(Excel)%20usage.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20your%20formula%20is%20using%20as%20input%20to%20the%20formula%20a%20sheet%20(%22New%20Office%20Copy%22)%20that%20is%20itself%20an%20output%20document....%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt's%20quite%20possible%20that%20somebody%20else%20here%20on%20the%20site%20will%20be%20able%20to%20help%20with%20the%20specific%20formula%20you're%20requesting%26nbsp%3B%26nbsp%3B%20...%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20but%20if%20I%20were%20in%20your%20shoes%2C%20I'd%20look%20into%20getting%20some%20solid%20training%20in%20Excel%20before%20attempting%20to%20actually%20revise%20this%20whole%20workbook.%20You%20might%20be%20able%20to%20get%20a%20formula%20to%20do%20what%20you're%20asking%2C%20but%20my%20worry%2C%20quite%20seriously%2C%20is%20that%20you'd%20just%20be%20perpetuating%20a%20fundamentally%20flawed%20design.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1554346%22%20slang%3D%22en-US%22%3ERe%3A%20Combining%20IF(AND%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1554346%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EObviously%20it%20is%20clear%20to%20me%20what%20I%20am%20talking%20about.%26nbsp%3B%20That%20is%20the%20difficulty%20of%20any%20job%20that%20has%20anything%20to%20do%20with%20trouble%20shooting%20problems%20and%20providing%20solutions.%26nbsp%3B%20I%20hope%20that%20there%20is%20someone%20out%20there%20that%20will%20want%20to%20spend%20a%20little%20time%20maybe%20asking%20a%20few%20questions%20to%20better%20understand%20what%20I%20am%20trying%20to%20do.%26nbsp%3B%20If%20it%20was%20easy%2C%20I%20wouldn't%20be%20looking%20for%20help.%3C%2FP%3E%3CP%3ESo%20here%20is%20some%20more%20explanation%20on%20what%20I%20am%20doing.%26nbsp%3B%20On%20my%20last%20post%20when%20I%20say%20Variety%2C%20Brand%2C%20Item%23%2C%20GTIN%23%2C%20those%20are%20columns%20on%20the%20tab%20%22Product%20list%22.%26nbsp%3B%20Product%20list%20has%20the%20data%20that%20is%20pulled%20into%20the%20tab%20%22New%20Office%20Copy%22%20which%20has%20corresponding%20fields.%26nbsp%3B%20The%20blank%20rows%20in%20the%20Product%20list%20are%20there%20for%20a%20reason.%26nbsp%3B%20When%20we%20have%20new%20items%20that%20need%20to%20be%20added%20to%20the%20list%2C%20they%20need%20to%20go%20into%20the%20correct%20area%20by%20Brand.%26nbsp%3B%20The%20space%20is%20there%20to%20insure%20the%20new%20line%20is%20inserted%20above%20the%20range%20that%20was%20created%20in%20the%20Name%20Manager.%26nbsp%3B%20And%20yes%2C%20New%20Office%20Copy%20is%20an%20output%20document%20that%20is%20used%20by%20our%20warehouse%20for%20bagging%20orders%2C%20the%20whole%20purpose%20of%20this%20file.%26nbsp%3B%20On%20the%20New%20Office%20Copy%2C%20you%20have%20to%20first%20choose%20the%20Brand%20from%20the%20drop%20down%2C%20then%20choose%20the%20Variety%20from%20the%20drop%20down.%26nbsp%3B%20This%20will%20automatically%20populate%20the%20GTIN%23%20%26amp%3B%20Item%23.%26nbsp%3B%20The%20formulas%20in%20these%20two%20fields%20are%20searching%20for%20Brand%20and%20Variety%20to%20find%20a%20match%20in%20the%20Product%20List%20and%20pull%20in%20the%20correct%20data.%26nbsp%3B%20When%20the%20Qty%20of%20Bags%20are%20entered%20in%20C8%2C%20it%20will%20populate%20the%20Treatment%20info%2C%20again%20searching%20by%20Brand%20and%20Variety%2C%20which%20is%20what%20I%20am%20needing%20pulled%20into%20the%20%22Pallet%20Label%22%20tab.%26nbsp%3B%20%26nbsp%3B98%25%20of%20the%20time%2C%20the%20New%20office%20copy%20is%20going%20to%20have%20cell%20D5%20unchecked%20(TRUE).%26nbsp%3B%20I%20am%20using%20a%20basic%20IF(AND%20statement%20and%20have%20no%20problem%20getting%20the%20treatment%20pulled%20into%20the%20pallet%20label%20in%20this%20instance.%26nbsp%3B%20However%2C%20I%20need%20to%20use%20a%20IF%20D5%20TRUE%2FFALSE%20statement%20because%20when%20cell%20D5%20is%20checked%20(FALSE)%2C%20some%20treatments%20are%20not%20being%20re-applied%20so%20those%20fields%20are%20blank%2C%20but%20they%20still%20need%20to%20be%20pulled%20into%20the%20pallet%20label%20because%20they%20are%20still%20valid.%26nbsp%3B%20This%20is%20why%20I%20am%20trying%20to%20figure%20out%20how%20to%20do%20an%20IF(AND%20statement%20if%20cell%20D5%20is%20FALSE%20using%20the%202%20formulas%20in%20my%20first%20post%2C%20which%20are%20slight%20variations%20to%20the%20formula%20on%20the%20New%20Office%20Copy%20tab%20for%20Apron%20XL%20%26amp%3B%20Nit%20Gold%20under%20the%20treatment%20info%2C%20searching%20for%20the%20Brand%20and%20Variety.%26nbsp%3B%20So%20basically%20a%20TRUE%20(basic%20IF%2FAND)%20%2F%20FALSE%20with%20a%20IF%2FAND%202%20item%20match.%26nbsp%3B%20As%20I%20said%20before%2C%20if%20there%20is%20a%20better%20way%20to%20accomplish%20this%20piece%20I%20am%20open.%3C%2FP%3E%3CP%3EIt%20may%20seem%20to%20be%20a%20fundamentally%20flawed%20design%2C%20and%20yes%2C%20maybe%20there%20is%20a%20better%20way%20to%20do%20this%2C%20but%20it%20has%20worked%20splendidly%20in%20another%20document%20which%20does%20not%20have%20a%20need%20for%20the%20Pallet%20Label%20tab.%26nbsp%3B%20I%20agree%2C%20I%20would%20not%20want%20anyone%20to%20spend%20hours%20trying%20to%20recreate%20all%20the%20formulas.%26nbsp%3B%20Everything%20else%20on%20this%20new%20document%20is%20working%20as%20needed.%26nbsp%3B%20I%20just%20need%20some%20assistance%20to%20figure%20out%20this%20last%20piece%20and%20hope%20someone%20who%20is%20much%20more%20skilled%20in%20excel%20formulas%20than%20me%2C%20would%20like%20to%20take%20on%20the%20challenge.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I have two statements that by themselves work.  I need to combine them to look for both and return APRON XL & NITRAGIN GOLD

 

APRON BY ITSELF

 =IFERROR(IF('NEW OFFICE COPY'!$D$5=FALSE,"",IF(INDEX('Product List'!$A$2:$BY$1003,MATCH('NEW OFFICE COPY'!$C$6,'Product List'!$D$2:$D$1003,0),MATCH('NEW OFFICE COPY'!$K$7,'Product List'!$A$1:$BY$1,0))="YES","")),"APRON XL")

 

NITRAGIN GOLD BY ITSELF

=IFERROR(IF('NEW OFFICE COPY'!$D$5=FALSE,””,IF(INDEX('Product List'!$A$2:$BY$1003,MATCH('NEW OFFICE COPY'!$C$6,'Product List'!$D$2:$D$1003,0),MATCH('NEW OFFICE COPY'!$K$9,'Product List'!$A$1:$BY$1,0))="X",””)),"NITRAGIN GOLD")

4 Replies

@kdwork 

 

It would be easier to help you if you helped us by posting a copy of your actual spreadsheet. With just the formulas, you're asking (no, "forcing") your reader to visualize the tables that you're referring to in your MATCH functions, among other things.

 

That aside, it may well be that the IFS function would be more suitable than a really complex combination of these two already-difficult-to-decipher formulas. With IFS you can specify, sequentially, condition+result pairings that satisfy various combinations of conditions. Here's the syntax:

=IFS (test1, value1, [test2, value2], ...)

 

You clearly know how to write formulas, so you might want to give that a try. If you need further help, though, I'd recommend posting a copy of the workbook you're working with, so long as it contains no confidential information.

@kdwork 

I have attached a sample copy of the file.  On the Pallet Label tab is where I am trying to use the formula.  You will see my two test formulas for the two separately.  Ultimately the combination of the two will appear in the B2:O2 when D5 on the New Office Copy is TRUE.  The formula that is currently in that box will need to be what shows when D5 on the New Office Copy tab is FALSE.

 

I am open to other options if there is something that will work better.  The current formulas were because on occasion there may be the same Variety name that is used in more than one Brand and it needs to pull in the correct item#/GTIN# and bagging info.  I am really not very familiar with formulas, just good at copying/editing from other spreadsheets, internet lookup and trial and error.  However this one I haven't been able to get to work because of the if False/True variable and where the IF/AND should go.  

@kdwork 

 

I am sorry, but that workbook is not one that I can afford the time to decode/decipher. There's so much there I'd want to change to take better advantage of Excel.

 

I'm sure that you are very clear in your own mind on what you're asking. But the reality is that it's clear to you because phrases like " there may be the same Variety name that is used in more than one Brand and it needs to pull in the correct item#/GTIN# and bagging info" are intelligible to you. You know what each word refers to in that phrase. I don't.

 

The "product list" tab bears some resemblance to a legitimate Excel Table, but the blank rows are artifacts of a human attempt to make it more readable to humans; in the process making it less amenable to computer (Excel) usage.

 

And your formula is using as input to the formula a sheet ("New Office Copy") that is itself an output document.... 

 

It's quite possible that somebody else here on the site will be able to help with the specific formula you're requesting   ...     but if I were in your shoes, I'd look into getting some solid training in Excel before attempting to actually revise this whole workbook. You might be able to get a formula to do what you're asking, but my worry, quite seriously, is that you'd just be perpetuating a fundamentally flawed design.

@mathetes 

Obviously it is clear to me what I am talking about.  That is the difficulty of any job that has anything to do with trouble shooting problems and providing solutions.  I hope that there is someone out there that will want to spend a little time maybe asking a few questions to better understand what I am trying to do.  If it was easy, I wouldn't be looking for help.

So here is some more explanation on what I am doing.  On my last post when I say Variety, Brand, Item#, GTIN#, those are columns on the tab "Product list".  Product list has the data that is pulled into the tab "New Office Copy" which has corresponding fields.  The blank rows in the Product list are there for a reason.  When we have new items that need to be added to the list, they need to go into the correct area by Brand.  The space is there to insure the new line is inserted above the range that was created in the Name Manager.  And yes, New Office Copy is an output document that is used by our warehouse for bagging orders, the whole purpose of this file.  On the New Office Copy, you have to first choose the Brand from the drop down, then choose the Variety from the drop down.  This will automatically populate the GTIN# & Item#.  The formulas in these two fields are searching for Brand and Variety to find a match in the Product List and pull in the correct data.  When the Qty of Bags are entered in C8, it will populate the Treatment info, again searching by Brand and Variety, which is what I am needing pulled into the "Pallet Label" tab.   98% of the time, the New office copy is going to have cell D5 unchecked (TRUE).  I am using a basic IF(AND statement and have no problem getting the treatment pulled into the pallet label in this instance.  However, I need to use a IF D5 TRUE/FALSE statement because when cell D5 is checked (FALSE), some treatments are not being re-applied so those fields are blank, but they still need to be pulled into the pallet label because they are still valid.  This is why I am trying to figure out how to do an IF(AND statement if cell D5 is FALSE using the 2 formulas in my first post, which are slight variations to the formula on the New Office Copy tab for Apron XL & Nit Gold under the treatment info, searching for the Brand and Variety.  So basically a TRUE (basic IF/AND) / FALSE with a IF/AND 2 item match.  As I said before, if there is a better way to accomplish this piece I am open.

It may seem to be a fundamentally flawed design, and yes, maybe there is a better way to do this, but it has worked splendidly in another document which does not have a need for the Pallet Label tab.  I agree, I would not want anyone to spend hours trying to recreate all the formulas.  Everything else on this new document is working as needed.  I just need some assistance to figure out this last piece and hope someone who is much more skilled in excel formulas than me, would like to take on the challenge.