PDA

View Full Version : Conbining IF Then Conditions in Excel



rnovz2
03-24-2019, 12:37 PM
Need Excel Help. I am a novice when it comes to building formulas in Excel. I have a document where I am trying to bring two conditions together if all conditions match a set criteria. The first condition is an easyIf, then formula. The other condition has several If, then formulas pullingfrom a different tab on the same workbook. Please review my initial thought process:

Condition one: =IF(c1=”yes”,”yes”,”no”)

If condition One is metwith a Yes, then the following condition must apply: =IF(H1=tab2!A1,"n",IF(H1=Tab2!A5,"n",IF(H1=Tab 2!A6,"n",IF(H1=Tab 2!A10,"n",IF(H1=Tab2!A13,"n",IF(H1=Tab 2!A15,"n",IF(H1=Tab 2!A17,"n",IF(H1=Tab2!A18,"n","y"))))))))

Any suggestions to combine the two conditions into one cell?

Paul_Hossler
03-24-2019, 01:23 PM
Top of my head

Replace the red in ...




=IF(c1=”yes”,”yes”,”no”)




… with




IF(H1=tab2!A1,"n",IF(H1=Tab2!A5,"n",IF(H1=Tab 2!A6,"n",IF(H1=Tab 2!A10,"n",IF(H1=Tab2!A13,"n",IF(H1=Tab 2!A15,"n",IF(H1=Tab 2!A17,"n",IF(H1=Tab2!A18,"n","y"))))))))





… which gives ...




=IF(c1=”yes”,IF(H1=tab2!A1,"n",IF(H1=Tab2!A5,"n",IF(H1=Tab 2!A6,"n",IF(H1=Tab 2!A10,"n",IF(H1=Tab2!A13,"n",IF(H1=Tab 2!A15,"n",IF(H1=Tab 2!A17,"n",IF(H1=Tab2!A18,"n","y")))))))),”no”)

rnovz2
03-24-2019, 05:41 PM
Thanks Paul. I still get the #NAME? result. However, I am further along than I was. I will make sure my formula reads correctly amd my parenthesis placement is accurate.

Paul_Hossler
03-24-2019, 06:31 PM
Thanks Paul. I still get the #NAME? result. However, I am further along than I was. I will make sure my formula reads correctly amd my parenthesis placement is accurate.

I think that each part that references another worksheet needs single quotes around the sheet name , e.g. H1='tab2'!A1 etc.

I just eyeballed it, and didn't make any test materials to really check it out

Maybe some one else has a more elegant approach

大灰狼1976
03-24-2019, 11:15 PM
Hi rnovz2!
Welcome to vbax forum!
Please refer to the attachment.

rnovz2
03-25-2019, 02:58 AM
You guys are awesome! That worked. Thanks again!

Paul_Hossler
03-25-2019, 06:23 AM
@ 大灰狼1976 (http://www.vbaexpress.com/forum/member.php?70849-大灰狼1976) -- good one :thumb

大灰狼1976
03-25-2019, 08:20 PM
@Paul--Please teach more in the future.:friends: