IF AND Statement - excel

I have the following If statement which is working the way I want it too.
However I need to add an extra condition where IF C7 has no data in it then it will show as 0. At the moment the cell the formula is in is showing #VALUE.
I think that I will need to use IF(AND however my attempts have failed me.
=IF(C6="BT",12.88+(C7-30)*0.6,IF(C7<35,4.3,4.3+(C7-35)*0.2))
Thanks

You could check for blanks first.
=If(c7="",0,IF(C6="BT",12.88+(C7-30)*0.6,IF(C7<35,4.3,4.3+(C7-35)*0.2)))
I just thought to add another approach I often use because I think it makes it easy to read is;
=If(c7="",0,1)*IF(C6="BT",12.88+(C7-30)*0.6,IF(C7<35,4.3,4.3+(C7-35)*0.2))
And there's another to skin this cat...
=Iferror(IF(C6="BT",12.88+(C7-30)*0.6,IF(C7<35,4.3,4.3+(C7-35)*0.2)),0)

Related

Google sheets, how do I get regexmatch to find a text string in a list?

I am new here, I have tried search for this answer and I can't find the same question
I am a totally self taught spreadsheet-maker, so if I have done some weird stuff - Please don't judge too harshly!
So I am using REGEXMATCH, and it just doesn't seem to be working like it usually does, and I can't work out why.
=IF($A13="","",(IF(REGEXMATCH({$L$13:$L$18},$A13),"YES","NO")))
I have made a workbook example to show the dilemma-
https://docs.google.com/spreadsheets/d/1paNG9Q-AciYbIR3HSgW7vxqNJmJBexgpm2lkLn32PN8/edit?usp=sharing
I want each line to tell me if its CODE-ID is in a list of items. I am pretty sure I had this working at some point, but I can't remember what I have changed. The regexmatch seems to just be picking up whether the code is in the first cell of the list.
Can anyone tell me what I have done wrong? I want the YES/NO column to change as I add new CODE-IDs to the list.
The weird thing is, I have got other cells to work by breaking the code right down to the basic regexmatch formula and building it up again, but it wont replicate when I copy it to another line. I don't know how to show that in this example because it isn't working here.
Let me know if this makes sense,
Thank you kindly,
Ellie
use in I13:
=INDEX(IF(A13:A="",,IF(ISNUMBER(MATCH(A13:A, L13:L18, 0)), "YES", "NO")))
You can use this array formula. No need to drag down to each cell.
=ArrayFormula(ISNUMBER(MATCH(A13:A18,L13:L18,0)))

Basic IF Statement question -probably right in front of me

Sorry i know this is super basic but i didn't know where else to ask and i really feel like the answer is right in front of me...
I have a spreadsheet which im going to use to log PAT test results. When i select the test type from a drop down it changes the standards and thresholds in the bit below and will tell me if each test passes or fails. It uses several vlookups and relative references - so far no VBA. Looking at this photo. What I'm trying to do is get the formula in cell I13 to read the symbol in F13 and use that in the formula rather than typing the symbol directly into the formula as its going to change when i change the Class Type option.
So far ive gotten to this (has a blank IF to start with to keep it neat:
=IF(H13="","",IF((H13&F13&(VALUE(G13))),"PASS","FAIL"))
The bit in bold is where the issue is. When i run the evaluate formula it boils the bold bit down to "0.01>2" which is correct however it then wont read that in the larger IF statement - i think its the quotation marks. So i think it needs another function to allow the IF statement to read that as the logical test rather than a text string.
I've tried VALUE, FORMULATEXT, NUMBERTEXT, all the ones that might be close to what I'm trying to do but 100% stumped now. Always bring sup the #VALUE Error.
Appreciate any advice? TIA
There is no built-in function for that. You need either a VBA function or the old EVALUATE XLM function (which you can't use directly in a cell, it has to be in a defined name). Sample UDF:
Function EvaluateFormulaString(FormulaString as string)
EvaluateFormulaString = application.evaluate(formulastring)
End Function
then your formula would become:
=IF(H13="","",IF(EvaluateFormulaString(H13&F13&(VALUE(G13))),"PASS","FAIL"))

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.

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")

Excel Match multiple criteria

Could someone help me turn this 2 Criteria match function into a 4 criteria match function please? This one works, but is only the start:
=INDEX(range1,MATCH(1,(A19=range2)*(B19=range3),0))
I also want a third and fourth match in the above formula, with those two being an OR option. I thought based upon the working version that this might work, but it doesn't:
=INDEX(range1,MATCH(1,(A19=range2)*(B19=range3)*(OR(C19=range4,D19=range5)),0))
I've been trying to use AND commands, my initial version of the first code above being this:
=INDEX(range1,MATCH(1,AND(A19=range2,B19=range3),0))
It always returns #N/A after CTRL+ALT+ENTER is entered though, so it's obviously an issue with my understanding of either MATCH or AND (or both I guess),
The first example works EXACTLY as intended, but unfortunately I don't know why and I can't work it out well enough to adapt it. Maybe I'm too tired and have run out of space in my head for the peculiar way in which Excel formulas work, but I've read and re-read the help files for them and still it doesn't make sense to me.
Any help would be greatly appreciated, as always.
Thanks,
Joe
I'm just guessing here, but would this work?
=INDEX(range1,MATCH(1,(A19=range2)*(B19=range3)*(((C19 = range4)+(D19 = range5))>0),0))

Resources