Complex if statement on a SharePoint calculated column - if-statement

I am trying to create a formula for a calculated column in SharePoint 2013
My columns are:
W Certification,
V Certification,
Certification Sorting (This is the calculated column)
If there are dates in both W Certification and V Certification, I want Certification Sorting to show a "3"
If there is only a date in W Certification, Certification Sorting Should show a "1"
If there is only a date in V Certification, Certification Sorting should show a "2"
This is the code I have tried: =IF([W Certification]=”Not Null”,”1”,IF([V Certification]=”Not Null″,”2”,IF(and [W Certification]=”Not Null″,”)([V Certification]=”Not Null″,”3”,)))) I still receive a syntax error.

Based on the requirements you've given, you're looking for a formula that resolves as so:
If [W Certification] is not blank and [V Certification] is not blank, show 3, otherwise...
If [W Certification] is not blank, show 1, otherwise...
If [V Certification] is not blank, show 2, otherwise...
Show 0 (you didn't specify what you want to show in this case, so I went with zero)
You can accomplish this using Excel-like formula syntax, taking advantage of the NOT() and ISBLANK() formulas, and keeping in mind that the IF() formula is evaluated like so:
IF(condition, value if true, value if false)
With that in mind, your formula would look something like this:
=IF(AND(NOT(ISBLANK([W Certification])),NOT(ISBLANK([V Certification]))),"3",IF(NOT(ISBLANK([W Certification])),"1",IF(NOT(ISBLANK([V Certification])),"2","0")))

Related

Array Formula in just one cell

I have a formula that do almost what I need. I'm trying to get a list of values with a condition depending about one value, is objetive 1 is equal or over to 80 show me the list of objetives equal or over 80. My formula is this one:
=ARRAYFORMULA(IF(('Product Prioritization Matrix'!C7:C >= 80), 'Product Prioritization Matrix'!B7:B,""))
My problem comes when I try to put this in just one cell in the last image will show what I need visualy.
The next images will show the sheets:
My formula
Expected result
I think a JOIN(... , FILTER( structure will work for this:
=JOIN(", ",FILTER(Sheet1!B:B,Sheet1!C:C>=80))

Creating a nested if statement. If cells K2 or D2 have certain words in

I have a formula right now that looks to cell K2 and writes the word "SKIP" in cell J2 if cell K2 is blank. Like below:
=if(ISBLANK(K2),"SKIP","")
What I want to do is add an additional check, which is, if cell D2 has the word "anonymous" in then keep the word "anonymous" in cell K2. Is this possible?
I tried this:
=if(D2="anonymous","SKIP","",if(ISBLANK(K2),"SKIP",""))
but get the error message "Wrong number of arguments to IF. Expected between 2 and 3 arguments, but received 4 arguments."
Can anyone help? Is Nested IF statements the right way to go? FYI I'm working in google sheets. Thanks.
For background, I have a google sheet that is feeding in user feedback. I am replying to these users via a mail-merge addon with different canned messages. K2 is blank until I manually categorise the feedback type which is added via data validation and until I do that I need J2 to have the word SKIP to ensure the mailmerge tool doesn't email them. Once I've categorised the row, J2 can have the word SKIP removed so that the mail merge tool can email that user. FYI another cell reads from K2 via vlookup to create canned messages. If K2 is anonymous, "SKIP" should remain.
IF statement takes only 3 parameters (logical_expression, value_if_true, value_if_false).
Based on the logic you gave, there's no need to use nested IF since we are modifying 2 different cells.
J2 - =iF(ISBLANK(K2),"SKIP","")
K2 - =IF(D2="anonymous", "anonymous", "")
But if you mean to populate the J2 with "anonymous" instead of K2, you can follow these steps below:
The first thing we have to check is the D2, if D2 have "anonymous" word, we put the word "anonymous" regardless if K2 is blank. Then, if D2 is empty, we will check if K2 is blank then put "SKIP" on it and 'blank' if not. If we will translate this into a IF Statement:
logical expression : D2='anonymous'
value if true : 'anonymous'
value if false : "IF(ISBLANK(K2),'SKIP', '')"
To summarize:
=IF(D2="anonymous","anonymous", if(ISBLANK(K2), "SKIP", ""))
From what you've written and added, I understand the following. You want:
If cell K2 is blank, make J2="SKIP".
If cell D2 = "anonymous", make J2="SKIP".
Values in D2 and K2 are changed manually by you (using a dropdown list?)
This is possible, with the following formula in J2:
=IF( OR( K2="", D2="anonymous"),"SKIP","")
Have I misunderstood anything?
Also, you've said that there might be different words in K2 or D2. Unless you provide us with all the possible words, and the outcomes you want in each case, we can't help you with a proper formula solution.
If you are still having issues, please share a copy of your sheet, since I am having trouble clearly understanding what you want to do.

How to count the number of blank cells in one column based on the first blank row in another column

I have a spreadsheet set up with tv program titles in column B, the next 20 or so columns are tracking different information about that title. I need to count the number of blank cells in column R relating to the range in column B that contains titles (ie, up to the first blank row in column B.)
I can easily set up a formula to count the number of empty cells in a given range in column R, the problem is as I add more titles to the sheet I would have to keep updating the range in the formula [a simple =COUNTIF(R3:R1108, "")]. I've done a little googling of the problem but haven't quite found anything that fits the situation. I thought I would be able to get the following to work but I didn't fully understand what was going on with them and they weren't giving the expected results.
I've tried these formulas:
=ArrayFormula(sum(MIN("B3:B"&MIN(IF((R3:R)>"",ROW(B3:B)-1)))))
=ArrayFormula(sum(INDIRECT("B3:B"&MIN(IF((R3:R)>"",ROW(B3:B)-1)))))
And
=if(SUM(B3:B)="","",SUM(R3:R))
All of the above formulas give "0" as the result. Based on the COUNTIF formula I have set up it should be 840, which is a number I would expect. Currently, there are 1106 rows containing data and 840 is a reasonable number to expect in this situation.
Is this what you're looking for?
=COUNTBLANK(INDIRECT(CONCATENATE("R",3,":R",(3+COUNTA(B3:B)))))
This counts the number of non-blank rows in the B column (starting at B3), and uses that to determine the rows to perform COUNTBLANK in, in column R (starting at R3). CONCATENATE is a way to give it a range by adding strings together, and the INDIRECT allows for the range reference to be a string.
a proper way would be:
=ARRAYFORMULA(COUNTBLANK(INDIRECT(ADDRESS(3, 18, 4)&":"&
ADDRESS(MAX(IF(B3:B<>"", ROW(B3:B), )), 18, 4)))
or shorter:
=ARRAYFORMULA(COUNTBLANK(INDIRECT("R3:"&
ADDRESS(MAX(IF(B3:B<>"", ROW(B3:B), )), 18, 4))))
or shorter:
=ARRAYFORMULA(COUNTBLANK(INDIRECT("R3:R"&MAX(IF(B3:B<>"", ROW(B3:B), ))))

How to populate a value when comparing two columns, VLOOKUP or IF?

I'm trying to create "Sale Rep" summaries by "Shop", where I can simply filter a column by the rep's name, them populate a total sales for each shop next to the relevant filter result.
I'm using this to filter all the Stores by Scott:
=(filter(D25:D47,A25:A47 = "Scott"))
Next, want to associate the Store/Account in F to populate with the corresponding value of E inside of G. So, G25 should populate the value of E25 ($724), G26 with E26 ($822), and F27 with E38 ($511.50)
I don't know how to write the formula correctly, but something like this is what I'm trying to do: =IF(F25=D25:D38),E25 I know that's not right, and it won't work in a fill down. But I'm basically trying to look for and copy over the correct value match of D and E inside of G. So, Misty Mountain Medicince in F27 will be matched to the value of E38 and populated in G27.
The filter is what's throwing me off, because it's not a simple fill down. And I don't know how to match filtered results from one column to a matched value in another.
Hope the screenshot helps. Screenshot of table:
Change Field Rep: Scott to Scott and you might apply:
=query(A25:E38,"select D,E where A='"&F24&"'")
// Enter the following into G25 and copy down column G
=(filter(E25:E47, D25:D47 = F25))
or
// Enter the following into G25 will expand with content in F upto row 47
=ArrayFormula(IF(F25:F47 <> 0, VLOOKUP(F25:F47, D25:E47, 2, FALSE),))

Prolog list not printing all the elements on console

I am using SWI-PROLOG version 6.6.6
I want to print all the attributes of a particular predicate type.
I have a predicate called law with arity 2.
Some of the facts are
law(borrow,'To borrow Money on the credit of the United States').
law(commerce,'To regulate Commerce with foreign Nations, and among the several States, and with the Indian Tribes').
law(unifomity,'To establish an uniform Rule of Naturalization, and uniform Laws on the subject of Bankruptcies throughout the United States').
law(money,'To coin Money, regulate the Value thereof, and of foreign Coin, and fix the Standard of Weights and Measures').
law(punishment,'To provide for the Punishment of counterfeiting the Securities and current Coin of the United States').
law(establishment,'To establish Post Offices and post Roads').
law(exclusiverights,'To promote the Progress of Science and useful Arts, by securing for limited Times to Authors and Inventors the exclusive Right to their respective Writings and Discoveries').
law(court,'To constitute Tribunals inferior to the supreme Court').
etc.
Now I want to access a law by entering its type.
Such as,
power(X) :- law(X,Y), display('\nCongress has the power : '),display(Y).
powers(ALL) :- display('\nCongress has the powers : '), law(_,Y), display('\n'), display(Y).
This works perfectly. Now, I also want the user to know what all types of laws are there so that the user can enter it as a query to get the corresponding law.
ex power(money).
For this, I made a query to get all these keywords and add them to a list and display the list.
But the list that is finally printed is not complete.
powerList(L) :- findall(X,law(X,_), L).
I use this code to get the list.
But the output on the console is
L = [borrow, commerce, unifomity, money, punishment, establishment, exclusiverights, court, piracyfelony|...].
But, there are more law types even after piracyfelony and they are not getting printed to the console. How do I get them printed?
This is a feature of Prolog's toplevel loops that tries to keep the output short.
To find out how you might change it, ask which Prolog flags your Prolog supports that have a value being a list of at least two elements:
?- current_prolog_flag(F,Options), Options = [_,_|_].
F = debugger_print_options,
Options = [quoted(true), portray(true), max_depth(10), attributes(portray), spacing(next_argument)] ;
F = toplevel_print_options,
Options = [quoted(true), portray(true), max_depth(10), spacing(next_argument)] ;
F = argv,
Options = [swipl, '-f', none] ;
false.
Now modify it accordingly:
?- length(L,10).
L = [_G303, _G306, _G309, _G312, _G315, _G318, _G321, _G324, _G327|...].
?- set_prolog_flag(toplevel_print_options,[quoted(true), portray(true), max_depth(0), spacing(next_argument)]).
true.
?- length(L,10).
L = [_G303, _G306, _G309, _G312, _G315, _G318, _G321, _G324, _G327, _G330].
(In newer versions starting with SWI 7 there is another flag value, answer_write_options.)