Having hangup with IF AND OR functions. Need one last tweak - excel

Disclaimer: I have never written code in Excel before. I have been building something for work during few days. I have a formula that WORKS! But there is one adjustment that I need to make, that I cannot make happen. Here is what I have. (Again, if its messy, I have no idea, but its currently working).
=IF(AND(D5="Yes LSC, PA's passed")*F5>G5-20,"AT0 Cannot be in same month as W/D",IF(AND(D5="Yes LSC, PA's not passed")*F5>G5-20,"AT0 Cannot be in same month as W/D",IF(AND(E5="Yes, systematic W/D")*F5>G5-20,"AT0 Cannot be in same month as a systematic W/D","")))
Background: I need an excel spreadsheet that we give to new employees as a "cheatsheet" It gives them prompts (I.E "Yes, LSC passed, or Yes, W/D"). They select the prompts and pass to a supervisor for processing.
Goal: I'm trying to write a formula that does not allow simple errors. For my purposes, I know Cell G5 must be AT LEAST 20 greater than F5. So I want an error message to appear every time they try to enter a value that breaks that rule. (Saves management time) And all of that WORKS!
Problem: If G5 is BLANK...It still gives me the message that I've told it to. However, IF G5 is BLANK, I don't need any of the formula to run. I have been trying to build this exception into my amateur formula but I cant get it.
I can understand whats happening.... Excel recognizes that if G5 is blank...then F5>G5-20 is TRUE -- And it gives me text that I want!! But I need an exception... I need it say understand that if G5 is BLANK, then I don't care about F5>G5-20. It can ignore the ENTIRE formula.
Any suggestions? I hope this makes sense.

How would this be?
=IF(ISBLANK(G5),"-", //insert your forumla here// )

an error message to appear every time they try to enter a value that breaks that rule is often handled with Data Validation rather than an IF function. I take it F5 will be completed before G5. Select G5, DATA > Data Tools - Data Validation, Data Validation..., Settings, Allow: Custom, Formula:
=G5>=F5+20
With other settings in their default state this should allow G5 to be blank (or to be populated and then blanked) but give a warning sound and message "The value you entered is not valid." at any attempt to key in an non-compliant value. The warning message may be customised and there is also an option to show an input message where entry of an invalid value is attempted, which might be used to explain the requirement. Alternatively the value might be accepted but later marked as being non-compliant.
It is though rather easy to bypass the validation - just copying from elsewhere and pasting into G5 could do so. Though copying from elsewhere and pasting into the cell with the IF formula would bypass that control too.
Data Validation might also substitute for some of the rest of your IF formula.

Related

Is there a way to get the the cell coordinates as an output

I am currently trying to build a sheet that allows the user to enter a list of stuff they need to do, and what day they need to do it by. Once they enter the day the need to do it by, which is not formatted as a date, but a simple number, it will then appear on the calendar. The issue I am running into is that it seems really hard to get the coordinates of a cell as an output. I am currently trying to use this line
'''=if(MATCH(J4,D5:D29),OFFSET(MATCH(J4,D5:D29),0,-2,1,1), "free")'''
but it keeps saying "the argument must be a range. Please tell me if I am missing something, or there is a way to do this better.
EDIT: The box that has the 2 and #N/A is where the data from the left side is supposed to be going. Since the date is 2, the word "heating" should be showing up in the cell.
Use simple XLOOKUP() function like-
=XLOOKUP(J$4,$D$5:$D$9,$B$5:$B$9)

FIND() formula to include "implicit intersection operator" change required

Over the weekend, my work laptop did a restart and Microsoft gave me the perfect gift in Excel, it introduced the implicit intersection operator which has completely messed up my world, literally every formula has gone crazy.
I've checked every link I can and cannot work out how to correct even the most basic formula. I would like to ask about this one so I can at least make some progress forwards.
=FIND('Value Definitions'!C3,'User Interface'!K:K) was my formula that was worked forever.
The explanation of this formula is to flag all value definitions that have been used within text of all rows in the user interface column K.
When Excel asks me to correct the formula, it rewrites it as =FIND('Value Definitions'!C3,#'User Interface'!K:K).
This results in #VALUE rather than a number of where the first occurrence was found. If I remove the # then I get #SPILL!.
Just to reiterate the purpose of the formula, I identify which phrases exist in an interface that come from the value definitions worksheet, irrespective of the number value I get (character count of first occurence), I just want to identify that it exists at least once. Then I can use this flag to lookup all related value definitions to be included on the user interface.
Thanks for your help in advance.

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

MS Excel IF statement confusion

I'm trying to make a spreadsheet for some calendars that I'm selling. I have a pricing scheme which depends on how many calendars a customer buys. I want to be able to keep track of sales, but I don't want to have to input the price per unit for each sale. I set up an IF statement that seems to work except for the last variable. Here's a screenshot:
As you can see, it works all the way to the last one. After the number reaches 11, the price per unit should drop to 6, but it doesn't! I know it must be a simple fix, but I don't know much about IF statement, so I'm stuck. Please help!
If you set up your price table similar to my set-up below, you can use a VLOOKUP formula to make it more flexible.
The formula in H10 is:
=VLOOKUP(G10,$B$1:$C$5,2,TRUE)
Enter and drag down.
The benefit of this approach is that you can change the lower bound count on the left and you'll get an adjustment without having to update the formula. Try changing the 2 in Count to 3 and you'll see the adjustments right away.
An added benefit is you can add some more values to the table for further pricing brackets.
If you must use an IF statement, try:
=IF(G10=1,9,IF(G10<=5,8,IF(AND(G10>5, G10<11),7,IF(G10>=11,6,IF(G10="","")))))
The problem with yours is it will never read the if(G10>=11 part because it has already evaluated if(G10>5
If it should have no output when G10 is blank, use the following variant:
=IF(ISBLANK(G10),"",IF(G10=1,9,IF(G10<=5,8,IF(AND(G10>5, G10<11),7,IF(G10>=11,6,IF(G10="",""))))))
I agree with #Nanashi that putting the price thresholds in a separate table and using vlookup is a better solution. That would make it possible to change the price points without having to edit multiple formulae.
But to just get your formula working, try this: =if(g10="","",if(g10=1,9,if(g1<=6,8,if(g10<=10,7,6))))
Notice that:
You don't need (and probably don't want) quotes around your numeric
values
The order of tests is important. In your original, the test for g10>=11 is never reached because it is in the else part of the g10>5 function.
A properly constructed table of quantities and pricing coupled with a VLOOKUP formula would be the best way to go and eases future pricing changes. But for the sake of diversity, your straightforward pricing structure could also be handled by the following:
=(6+(G10<11)+(G10<6)+(G10<2))*(G10>0)
In the formula, "G10>5" should be "G10<=10". Otherwise, when it gets to 11, it still meets the G10>5 criteria.

Resources