Excel nested if statement error how to fix? - excel

trying to do a nested if :
=IF([Years of Service]>10,'Data Tables'!$B$11,"if([years of service]>5,'Data Tables'!$b$10)")
getting a spill error.

You don't indicate what you want to do and I'm not sure exactly what you really want to do.
But it seems your formula is within a Table. That being the case, formulas that output arrays, when placed in a Table will produce the #SPILL! error.
If, what you want to do, is to compare the Years of Service from the same row as the formula, then you need to refer just to that row, so as to not output an array.
eg:
=IF([#[Years of Service]]>10,'Data Tables'!$B$11,
IF([#[Years of Service]]>5,'Data Tables'!$B$10,
IF([#[Years of Service]]>1,'Data Tables'!$B$9,
'Data Tables'!$B$8)))
If you want something else, then you'll need to provide more detail.

Related

I got #num! error in my formula I used in Excel. I would like to ask where I got an error and What should I do?

I have an excel file that is populated with a lot of formulas. I am trying to populate the result by subtructing the latest value to the previous value and dividing the result given in the cell. Please see the photo below. As you can see, starting in row 6 i used the formula of:
"=ABS(IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),10),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),9))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),9),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),8))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),8),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),7))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),7),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),6))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),6),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),5))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),5),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),4))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),4),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),3))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),3),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),2))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),2),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),1))/E7,IF(F7<=LARGE(IF(find3=$H7,$F$6:$F$196),1),(F7-LARGE(IF(find3=$H7,$F$6:$F$196),1))/E7*(F7-LARGE(IF(find3=$H7,$F$6:$F$196),2))/E7)))))))))))"
In order to get the result of =(f7-f6)/e7. I added if functions cause there are some values that the lookup value is mentioned ($H7) below the table. When the lookup function was changed (please see the second photo), the formula was changed also into this:
"=ABS(IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),10),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),9))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),9),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),8))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),8),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),7))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),7),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),6))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),6),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),5))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),5),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),4))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),4),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),3))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),3),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),2))/E15,IF(F15<=LARGE(IF(find3=$C15,$F$6:$F$196),2),(F15-LARGE(IF(find3=$C15,$F$6:$F$196),1))/E15,(F15-LARGE(IF(find3=$C15,$F$6:$F$196),2))/E15))))))))))"
But I've got a result of a #num! error. It's the same statement, the only difference is the looked up value. And when I try to show the calculation steps (Please see the third photo attached below), it says I've got an error in the first statement but why it was working on the first lookup value?
I am noob in excel. Please help me!!!
The reason for this error is that the LARGE function returns #NUM because the underlying array is empty / contains the FALSE result from your IF function (see here for details https://support.microsoft.com/en-us/office/large-function-3af0af19-1190-42bb-bb8b-01672ec00a64).
The reason here likely is that your find3=$C15,$F$6:$F$196 does not find a match.
Since we do not know what find3 is, you will need to look into the reason for that on your end (i.e., is there value of 5725 EGJ in your find3 data range? If not, why not? If yes, are you sure it spelled the same way (no leading spaces)?).
Once that is fixed you should be good to go.

EXCEL - Circular Reference Error when Entering Data

I've got another one that is really kicking my butt.
I know why the error is occurring. I just don't know how to fix it. There are a lot of IF statements so I'm thinking maybe they are arranged in a way that is causing the error. I'm sure there is a much cleaner way to write them.
Whenever I try to input data into D7 or E7 I get the circular reference error.
These are my current formulas for all relevant cells:
F7: =IF(C7<0,"FAIL",IF(OR(ISBLANK(B7),ISBLANK(C7))," ",IF(ABS(F8)<=30,"PASS","FAIL")))
G7: =IF(D7<0,"FAIL",IF(OR(ISBLANK(B7),ISBLANK(D7))," ",IF(ABS(G8)<=30,"PASS","FAIL")))
H7: =IF(E7<0,"FAIL",IF(OR(ISBLANK(B7),ISBLANK(E7))," ",IF(ABS(H8)<=30,"PASS","FAIL")))
F8: =IF(B7<0,"",IF(C7<0,"",IF(D7<0,"",IF(E7<0,"",IF(G7="FAIL","",IF(H7="FAIL","",IF(ISBLANK(B7),IF(ISBLANK(C7),"","input Lw_Lw"),IF(ISBLANK(C7),"input Lw_Up",SUM(C7-B7)))))))))
G8: =IF(B7<0,"",IF(C7<0,"",IF(D7<0,"",IF(E7<0,"",IF(F7="FAIL","",IF(H7="FAIL","",IF(ISBLANK(B7),IF(ISBLANK(D7),"","input Lw_Lw"),IF(ISBLANK(D7),"input Up_Lw",SUM(D7-B7)))))))))
H8: =IF(B7<0,"",IF(C7<0,"",IF(D7<0,"",IF(E7<0,"",IF(G7="FAIL","",IF(F7="FAIL","",IF(ISBLANK(B7),IF(ISBLANK(E7),"","input Lw_Lw"),IF(ISBLANK(E7),"input Up_Up",SUM(E7-B7)))))))))
Snip of Excel table
Any help would be much appreciated!
I worked out the following two formulas for you. Please try them.
[F7] =IF(IFERROR(ABS(F8)<=30,FALSE),"PASS","FAIL")
[F8] ==IF(ISBLANK(C7),"input "&F$3,IF(OR(COUNT($B7:$E7)<4,COUNTIF($B7:$E7,"<0")>0),"",SUM(C7-$B7)))
Copy them from F7:F8 to G7:H8.
The basic principle I applied in order to avoid a circular reference is to do all testing in row 8 with the outcome that F8 will either hold a blank or a number. Therefore "Pass" or "Fail" in row 7 can be decided based on the number: If the number is within range it's a PASS, else it's failed. Note that Abs("") will cause an error. Therefore IFERROR(ABS(F8)<=30,FALSE) will return False in case F8 = "". Effectively, this is the reverse of what I wrote in my comment above.
I looked for shorter expressions for other tests as well. Count() will only count cells with numbers in them. Therefore I use this function instead of a series of ISBLANK() queries. Similarly for COUNTIF($B7:$E7,"<0").
I used mixed absolute and relative addressing to enable copying formulas to other columns and referred to the column captions in place of repeating the same texts in the formulas.
I didn't fully test my solution. However, with my above explanation as a guide you should be able to take possession and eliminate any errors I might have left behind.

If/And functions are not working correctly in my formula, can someone help me?

I have a field in my excel spreadsheet that depends on several different fields to determine the calculation that should be made. I think I have my formula correct but I am not getting the appropriate responses so I know there must be something I am missing. Let me start by summarizing what I am attempting to do.
If D5=2, then I need to verify if $AI$12-AB14>(3/24) and return a T if it is or leave the field blank if not. Alternatively, if D5=1, then I have to also verify that Y14=Y and Z14=Y, and finally $AC$12-AA14>(3/24) and return a T if so, or leave the field blank if not.
(The reference to 3/24 is required as I am performing time calculations from data entry fields pulling from a userform)
What I am receiving for a response is 'True'. That is not an option so I suspect it is returning the result of a specific logical statement? Below is my formula:
=IF(AND(D5="2",$AI$12-AB14>(3/24),),"T","")
=IF(AND(D5="1",Y14="Y",Z14="Y",$AC$12-AA14>(3/24),),"T","")
I can't insert an image in comments, so I'll reply. This simplified example shows how it works:
And pay attention to D5 - are there really values 1 and 2 as text. If not, the quotation marks must be removed from the formula

Data Validation based off multiple criteria

Unable to compile all formulas in single cell to validate the data
Reviewed other post's with similar request but I am still unable to figure out what I am doing wrong trying to string these together
Unique Entry's
=COUNTIF($A$2:$A$3000, A2)<=1
15 Character Max
=A2>15
Does not start with a space
=IF(OR(LEFT(A2,1)=" "),FALSE,TRUE)
No Punctuation
=ISNUMBER(SUMPRODUCT(SEARCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")))
Attempted to string these together using =OR but it does not seem to work. Here is what I tried.
=OR(AND(A2>15),AND(COUNTIF($A$2:$A$3000,A2)<=1),AND(IF(OR(LEFT(A2,1)=" "),FALSE,TRUE)),AND(ISNUMBER(SUMPRODUCT(SEARCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")))))
Another thing I don't understand and may be my issue is that I need this to check A2:A3000 my formulas do not account for that except for the unique entries but will data validation take that into account or will the formula need to look at all cells? Hope this makes sense.
You would only use AND:
=AND(ISNUMBER(SUMPRODUCT(SEARCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"))),LEFT(A2,1)<>" ",LEN(A2)<=15,COUNTIF($A$2:$A$3000, A2)<=1)
Apply it to the whole range but refer to the upper left cell relatively.

Simple Excel IF statement not working.

I have no idea why this isn't working. It looks exactly like multiple sources I have found around the web. What am I missing?
Code:
=IF(A1="Select all",B1="Yep",B1="Nope")
This is the result:
You only need to put the result values in the 2nd and 3rd arguments:
=IF(A1="Select all","Yep","Nope")
It looked like you were trying to assign the values to B1 cell, but what actually happens is you get the result of doing a comparison to check whether B1 is equal to "Yep", which is causes a circular reference error because the formula tries to look at itself.
You don't need to say B1="Yep" Just put
=IF(A1="Select all", "Yep", "Nope")

Resources