How to write a compound IF statement checking two sets of two values - excel

I know the title is confusing, but I can't figure our how to word it properly. I'm trying to figure out how to properly format a compound conditional in an IF statement in Excel. It's for a school project that's due tomorrow.
I already have something like this
=if(AND(b152="oval.jpg",c152="q'")OR(AND(b152="triangle.jpg", c153="p'")), "Correct", "Incorrect")
In psuedocode I want it to run something like this:
if (b152=="oval.jpg" && c152=="q'") or (b152=="triangle.jpg", c153="p'"):
print("YES!")
else
print("False!")
I know I'm missing something here. My current excel code returns false even if the conditions are true. Thanks ahead of time!

OR is a function in Excel, like AND. Try something like this:
=if(OR(AND(b152 = "oval.jpg", c152 = "q'"), AND(b152 = "triangle.jpg", c153 = "p'")), "Correct", "Incorrect")

Related

How can I emphasize an impex macro if it is part of a string?

How can I emphasize an impex macro if it is part of a string?
We can do something like this:
$prefix=alpha
$contentCatalog=$prefixContentCatalog
... and $contentCatalog will return "alphaContentCatalog".
Can I make the macro more explicit with something like:
$contentCatalog={$prefix}ContentCatalog
... so that I can immediately see that the macro is $prefix? Is there a syntax for this? (NOTE: The curly brace is just an example. This syntax/symbol doesn't exist for this purpose)
Another example: If I have something like below, it becomes confusing:
$prefix=electronics
$contentCatalog=$prefixContentCatalog
$contentCatalogFolderName=$contentCatalogFolder
But it can be easier to understand if it can be written as:
$prefix=electronics
$contentCatalog={$prefix}ContentCatalog
$contentCatalogFolderName={$contentCatalog}Folder
Hhmmm, unfortunately I don't think there is anything for this. I only see some workarounds like special naming for macro variables:
$_prefix_=electronics
$_contentCatalog_=$_prefix_ContentCatalog
$contentCatalogFolderName=$_contentCatalog_Folder
there is an alternate way to customize the micro via injecting property in local.properties and using ConfigPropertyImportProcessor.
UPDATE GenericItem[processor = de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor]; pk[unique = true]
$contentCatalog = $config-ly.br.content.catalog
$contentCV = catalogVersion(CatalogVersion.catalog(Catalog.id[default = $contentCatalog]), CatalogVersion.version[default = Staged])[default = $contentCatalog:Staged]
and entries should be added in local.properties.
ly.br.content.catalog=TestContentCatalog
Note:This is useful when we have multi-country.

IF statement to determine date

I want to set an order completion date based on the words Standard or Rush.
Currently I have it set up where if a cell shows the word Standard, it will give me a date, but once I try to add Rush to that, it get errors
=IF(ISNUMBER(SEARCH("VF",B2)), IF(J2="Standard", WORKDAY(TODAY( )+2,1)), "")
I also tried this, but when I type Rush into J2, the result shows as just FALSE
=IF(ISNUMBER(SEARCH("VF",B2)), (IF(J2="Standard", WORKDAY(TODAY( )+2,1))), (IF(J2="Rush", WORKDAY(TODAY( )+1,1))))
The idea here is to make an order wanted date based on the Rush and Standard time frame.
You have embedded your new IF function inside of the wrong if.
This: (IF(J2="Standard", WORKDAY(TODAY( )+2,1))) is going to return a date or FALSE. You want to change that FALSE to return your next IF statement. Instead:
=IF(ISNUMBER(SEARCH("VF",B2)), IF(J2="Standard", WORKDAY(TODAY( )+2,1), IF(J2="Rush", WORKDAY(TODAY( )+1,1))), "")
You return nothing "" in the case that your ISNUMBER() fails still.

nested ifs with multiple sumifs based on changing criteria

I am having trouble with this formula and would like to know if I am even building it in the correct order or how i can change it to get the desired result. Getting formula missing an opening or closing parenthesis error:
=IF(BH2="PPD TO FSC",SUMIFS('ALL BIDS'!R:R,'ALL BIDS'!D:D,BV2,'ALL BIDS'!E:E,I2,'ALL BIDS'!W:W,'DC TOOL'!U2,'ALL BIDS'!G:G,'DC TOOL'!V2,'ALL BIDS'!H:H,'DC TOOL'!M2),SUMIFS(FREIGHT!Z:Z,FREIGHT!Q:Q,'DC TOOL'!F2,FREIGHT!M:M,H2,FREIGHT!O:O,"PPD",FREIGHT!AA:AA,GRIDS!$U$3),IF(BH2="PPD TO GDC",SUMIFS('ALL BIDS'!R:R,'ALL BIDS'!D:D,F2,'ALL BIDS'!E:E,I2,'ALL BIDS'!W:W,'DC TOOL'!U2,'ALL BIDS'!G:G,'DC TOOL'!V2,'ALL BIDS'!H:H,'DC TOOL'!M2),SUMIFS(FREIGHT!Z:Z,FREIGHT!Q:Q,'DC TOOL'!F2,FREIGHT!M:M,H2,FREIGHT!O:O,"PPD",FREIGHT!AA:AA,GRIDS!$U$3))
Looks like you want 3 different possible SUMIFS, with the logic being as follows:
IF BH2 = "x" SUMIFS1, IF BH2 = "y" SUMIFS2 else SUMIFS3 so you need to write that like this:
=IF(BH2="PPD TO FSC",SUMIFS('ALL BIDS'!R:R,'ALL BIDS'!D:D,BV2,'ALL BIDS'!E:E,I2,'ALL BIDS'!W:W,'DC TOOL'!U2,'ALL BIDS'!G:G,'DC TOOL'!V2,'ALL BIDS'!H:H,'DC TOOL'!M2),IF(BH2="PPD TO GDC",SUMIFS('ALL BIDS'!R:R,'ALL BIDS'!D:D,F2,'ALL BIDS'!E:E,I2,'ALL BIDS'!W:W,'DC TOOL'!U2,'ALL BIDS'!G:G,'DC TOOL'!V2,'ALL BIDS'!H:H,'DC TOOL'!M2),SUMIFS(FREIGHT!Z:Z,FREIGHT!Q:Q,'DC TOOL'!F2,FREIGHT!M:M,H2,FREIGHT!O:O,"PPD",FREIGHT!AA:AA,GRIDS!$U$3)))

IIF and LEFT functions

Could somebody tell me what I'm doing wrong in this query to get a calculated column?
IIf(Left([VIN Number],2)="1F" OR "2F" OR "3F" OR "1L” OR “2L” OR “NM”,”Food”,"Comp")
It's giving me error saying "you may have entered an operand without an operator"
You can't have a compound condition like ...
Something = "a" OR "b"
You would have to repeat the Something = after OR ...
Something = "a" OR Something = "b"
For your query's IIf() expression, an In() list containing the match values would be more concise ...
IIf(Left([VIN Number],2) IN ("1F", "2F", "3F", "1L", "2L", "NM"), "Food", "Comp")
Beware your code sample includes typesetting quotes (“ and ”). Make sure you use plain quotes (") in your real code.
The OR operator doesn't work how you expect it to. It requires statements that resolve to TRUE or FALSE on either side of it, so you can't check if something is equal to one of many things like this.
You either need to do:
Iif(Left([VIN Number],2)="1F" OR Left([VIN Number],2)="2F" OR Left([VIN Number],2)="3F"...., "Food", "Comp")
or you need to do:
Iif(Left([VIN Number],2) In("1F","2F", "3F"....), "Food", "Comp")

VBA creating a string based on conditions

I need to create a string of the next type:
"<a=1 b=123 c=15 d=19 e=12345>" (rough example)
BUT if any of these variable doesn't exist, it shouldn't be printed at all. Hard to explain, but here is an example.
Desired output: <a=1 c=15 e=12345>
My current output: <a=1 b= c=15 d= e=12345>
I can do this by many case conditions, but is there a more elegant way to do this, ideally in one statement. May be something like (just what I want to find, it's not my expectation code)):
print "<[if a exists]a=" & a & ", [if b exists] b=" & b ...>"
Thanks!
Sounds like the easiest way to do this is using the iif() function. This is more or less what you ask for with [if a exists]. Not sure what condition to test because the information you have given does not make that clear. But I think you should be able to figure it out.

Resources