Excel IF(AND) Statements - excel

I have set up a betting worksheet with filters for date start / end, bet type, tipper, sports, leagues and variable.
The issue have that when I come create a formula referencing all of these filters, I get the "You've entered too many arguments in this function." error.
Before adding the Leagues filter, I started off with just date start / end, bet type, tipper, sports and variable filters and I had this formula which was working fine:
=IF(H12<>"",
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P"),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B>1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B>1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B>1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B>1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
"")))))))))))))))),
"")
I then added a league filter into the mix and got the error. This is the amended formula containing the league filter (FILT_T).
=IF(P12<>"",
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P"),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C=1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C=1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B>1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C=1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C=1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B>1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B>1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C>1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C>1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C>1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B>1,FILT_C>1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
"")))))))))))))))))))))),
"")
Can anyone shed light on what I'm doing wrong?

You can only have a maximum of 255 cell referenced or indeed numbers referred to in a formula. The following has 255 ones and it works fine, adding an additional one will give you the error
=IF(AND(1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1);"t";"f")

Related

2 nest if with different source data excel

I have 2 data sources and i want to lookup data using Vlookup by using unique ID,
1st data source will show "X" if the ID locate there,
2nd data source will show "Y" if the ID locate there,
the other responses of ID lookup will show nothing ""
Data source 1:
20000543
10056577
10032255
10008287
10011657
10008119
10008212
10007880
10052842
10007959
10062445
10011361
10008079
10008836
10007792
10052651
10007793
10047404
10007913
10007528
10008252
10007388
10007311
10057445
10036263
20004767
20004010
20001276
20010704
10039655
10062427
20010703
10048331
Data source 2:
20003695
20010673
10011463
10021645
10007439
20001123
10008276
10055885
10007718
10007587
10007364
10055257
10007651
10056216
10054797
10052500
10059984
10027674
10010153
10007808
10008182
10007763
10007428
10008102
10050130
10037579
10021909
10009539
10057979
I want to lookup value by using ID "10008102" which is locate in Data source 2 than it will show "Y" for final result,
How can I achieve this?
Much appreciate that.
Thank you
Please don't kill me for the overkill, but I came up with this:
=IF(IFNA(MATCH(A1,Sheet2!A$1:A$29,0),"N")="N","N","Y")
The story:
Match(...,...,0) searches for an exact match (hence the zero).
you need to look for a relative reference, like A1 (without dollarsigns), so that you can drag down and use another cell reference at any time
you need to look inside a fix array, like A$1:A$29, so that, when you drag down, you don't modify the array you're looking in.
Match() either gives a number or an #N/A error in case not found.
IFNA() translates #N/A to "N" (but there's no else-case in IFNA())
IF() has an else-case.
I'm inviting Excel wizards to come up with a simpler solution :-)
Do you possibly want to account for the value existing in both or none of the columns?
=IF(AND(COUNTIF(A:A,E2)>0,COUNTIF(B:B;E2)>0),"X&Y",
IF(COUNTIF(A:A,E2)>0,"X",
IF(COUNTIF(B:B,E2)>0,"Y",
"NONE")))

Combining CONCAT, DATEDIF, and nested IF -getting #VALUE! error

Trying to fill an investment field with Short/Long Term & Capital Gain/Loss. Ending values should be one of the following - STCG, STCL, LTCG, LTCL. (I tried to cut/paste an excel image but it's icky, sorry)
Mini Spreadsheet - Date Acquired (H62), G/L per share (J62), Position (result)
For some investments, the date acquired is Var (for various purchases) or blank (for cash). If it is "Var", the function should return "LT" and skip the DATEDIF function. If the date is blank, the function should be skipped entirely and return blank as there is neither gain nor loss.
=IF($H62="","",CONCAT(IF(OR($H62="Var", DATEDIF($H62,TODAY(),"d")<365),"ST","LT"),IF($J62<0,"CL","CG")))
My original function worked well, except when the Date Acquired field (H62) had "Var", I got a #VALUE! error. I tried to do this with nested IFs and with IFS function, but couldn't get it to work (Problem with this formula error): =IF(H61="","",CONCAT(IF($H61="Var", "LT",IF(DATEDIF($H61,TODAY(),"d")<365),"ST","LT")),IF(J61<0,"CL","CG")))
The logic should be: If date="" then "" else concat LT/ST test and CL/CG test
LT/ST test: If date="Var" then "LT" else if date days before today < 365,"ST" else "LT"
CL/CG test: If gain per share <0 "CL" else "CG" (working)
Please help! I could add a hidden column (I'd rather not) or do the whole thing with nested IFs or IFS but I'd have to repeat arguments and that's sloppy & asking for trouble.

Wild card is not working for extracting status in excel

Below is my table, I want to extract status starting with "QATs" but the formula is not working.
CRM,QATsPending
PRM,QATSInprogress
CRM,QATsOnHold
CRM,QATsCompleted,Screen
My formula is working
=IF(G2="*Pending*", "QATsPending", IF(G2="*Completed*","QATsCompleted", IF(G2="*O2InProgress*", "QATsInProgress", "QATsOnHold")))
It is giving on QATsOnHold as output.
Your ELSE (, "QATsOnHold")))) is triggered for everything as no values in your Table actually EQUAL anything you are trying to match
You are also putting the value to match and the value to return in the wrong order.
It should be Match, Return, e.g. =IF(G2="QATsPending", "Pending"... not =IF(G2="Pending", "QATsPending"
Your code:
=IF(G2="Pending", "QATsPending", IF(G2="Completed","QATsCompleted", IF(G2="O2InProgress", "QATsInProgress", "QATsOnHold")))
Should be:
=IF(G2="QATsPending", "Pending", IF(G2="QATsCompleted","Completed", IF(G2="QATsInProgress", "O2InProgress", "QATsOnHold")))
But looking at your Table.. might actually be:
=IF(G2="QATsPending PRM", "Pending", IF(G2="QATsCompleted","Completed", IF(G2="QATSInprogress CRM", "O2InProgress", "QATsOnHold")))

Error with formula trying to use IF(AND with three conditions

I am trying to write a formula to evaluate all possible values in three cells and score them in another. Excel says that there is a problem with my formula, but I can't locate it. Your help is appreciated.
I am using IF(AND throughout my spreadsheet, but only with two values. Those formulas are accepted by Excel.
=IF(AND(B2="No",B3="Red",B5="No"),0,
IF(AND(B2="No",B3="Green",B5="No",2,
IF(AND(B2="No",B3="Blue",B5="No",3,
IF(AND(B2="No",B3="Yellow",B5="No",5,5,
IF(AND(B2="No",B3="Red",B5="Yes"),0,
IF(AND(B2="No",B3="Green",B5="Yes"),2,
IF(AND(B2="No",B3="Blue",B5="Yes",3,
IF(AND(B2="No",B3="Yellow",B5="Yes",5,
IF(AND(B2="Yes",B3="Red",B5="Yes",0,
IF(AND(B2="Yes",B3="Green",B5="Yes",1,
IF(AND(B2="Yes",B3="Blue",B5="Yes",2,
IF(AND(B2="Yes",B3="Yellow",B5="Yes",5,
IF(AND(B2="Yes",B3="Red",B5="No",0,
IF(AND(B2="Yes",B3="Green",B5="No",1,
IF(AND(B2="Yes",B3="Blue",B5="No",2,
IF(AND(B2="Yes",B3="Yellow",B5="No",3))))))))))))))))
Excel states "There is a problem with this formula".
You had a 5,5 where you should have had a 5 and where missing many ) to close the ANDs
=IF(AND(B2="No",B3="Red",B5="No"),0,
IF(AND(B2="No",B3="Green",B5="No"),2,
IF(AND(B2="No",B3="Blue",B5="No"),3,
IF(AND(B2="No",B3="Yellow",B5="No"),5,
IF(AND(B2="No",B3="Red",B5="Yes"),0,
IF(AND(B2="No",B3="Green",B5="Yes"),2,
IF(AND(B2="No",B3="Blue",B5="Yes"),3,
IF(AND(B2="No",B3="Yellow",B5="Yes"),5,
IF(AND(B2="Yes",B3="Red",B5="Yes"),0,
IF(AND(B2="Yes",B3="Green",B5="Yes"),1,
IF(AND(B2="Yes",B3="Blue",B5="Yes"),2,
IF(AND(B2="Yes",B3="Yellow",B5="Yes"),5,
IF(AND(B2="Yes",B3="Red",B5="No"),0,
IF(AND(B2="Yes",B3="Green",B5="No"),1,
IF(AND(B2="Yes",B3="Blue",B5="No"),2,
IF(AND(B2="Yes",B3="Yellow",B5="No"),3,""))))))))))))))))
But I think you can do this with a simpler formula:
=IFERROR(IF(B2 = "No",CHOOSE(MATCH(B3,{"Red","Green","Blue","Yellow"},0),0,2,3,5),IF(B5="Yes",CHOOSE(MATCH(B3,{"Red","Green","Blue","Yellow"},0),0,1,2,5),CHOOSE(MATCH(B3,{"Red","Green","Blue","Yellow"},0),0,1,2,3))),"")
You could put your logic in string form in one cell (say, F1):
0NOREDNO 2NOGREENNO 3NOBLUENO 5NOYELLOWNO 0NOREDYES 2NOGREENYES 3NOBLUEYES 5NOYELLOWYES 0YESREDYES 1YESGREENYES 2YESBLUEYES 5YESYELLOWYES 0YESREDNO 1YESGREENNO 2YESBLUENO 3YESYELLOWNO
Then your code reduces to:
=MID(F1, FIND(UPPER(B2&B3&B5),F1)-1, 1)
This would also make it extremely easy to add more conditions in the future.
Try this:
=IF(B3="Red",0,
IF(B3="Green",
IF(B2="Yes",1,
IF(B2="No",2,NA())),
IF(B3="Blue",
IF(B2="Yes",2,
IF(B2="No",3,NA())),
IF(B3="Yellow",
IF(AND(B2="Yes",B5="No"),3,5),
NA()))))
Hope that helps

No value given for one or more required parameters - OLEDB cmd updating Excel

I am getting the error in the title when trying to update a row in Excel with blank values in these positions [BI6:DP6].
I have counted and it appears there are 60 spots in these cells to update, so I am stuck.
Any ideas? String to update is below:
UPDATE [My Sheet$BI6:DP6] SET F1=1, F2=0, F3=0, F4=0, F5=0, F6=1, F7=0, F8=1, F9=1, F10=1, F11=1, F12=1, F13=0, F14=0, F15=1, F16=1, F17=1, F18=1, F19=1, F20=1, F21=1, F22=0, F23=0, F24=0, F25=0, F26=0, F27=0, F28=1, F29=1, F30=0, F31=0, F32=0, F33=1, F34=0, F35=1, F36=1, F37=1, F38=1, F39=0, F40=0, F41=0, F42=1, F43=1, F44=0, F45=1, F46=0, F47=0, F48=1, F49=0, F50=0, F51=0, F52=1, F53=1, F54=0, F55=1, F56=0, F57=0, F58=1, F59=0, F60=0
I was using an update statement for a macro enabled spreadsheet, which required us to use the 'HDR=NO' value for Extended Properties attribute of the spreadsheet. Along with that, every cell in the spreadsheet needed to be formatted to "Text" instead of "General" (or numeric, currency) in this case in order to get the values into the cells correctly.
Excel apparently attempts to covert these values with little to no information returning back upon error in the OLEDB connection, and so it makes this issue very difficult to fix.

Resources