Nesting IF and ISBLANK - if-statement

Please help. I'm trying to get the cell to return blank but I'm having trouble.
=IF(AND($I2>1,AG2>=0.5),1,IF(AND($I2<1,AG2<0.5),1,IF(AG2=""),"",0))
There's and error message when I include the last argument IF(AG2=""),"",0.
This alternative hasn't worked either =IF(ISBLANK(AG2),"",IF(AND($I2>1,AG2>=0.5),1,IF(AND($I2<1,AG2<0.5),1,0)))
I've also tried with using IFERROR to return blank rather than DIV/O which ruins my pivot table. Thanks so much

Perhaps:
=IF(AND($I2>1,AG2>=0.5),1,IF(AND($I2<1,AG2<0.5),1,IF(AG2="","",0)))
Your error was parenthetical.

Related

Google Sheets ARRAYFORMULA to skip blank rows

How to make my ARRAYFORMULA(A1 + something else) to stop producing results after there are no more values in A1 column, eg. to skip blank values. By default it gives endlessly "something else".
Here is my demo sheet:
https://docs.google.com/spreadsheets/d/1AikL5xRMB94BKwG34Z_tEEiI07aUAmlbNzxGZF2VeYs/edit?usp=sharing
Actual data in column A1 is regularly changing, rows are being added.
I tried the others and they didn't work. This does though:
=ARRAYFORMULA(filter(A1:B;A1:A<>"";B1:B<>""))
use:
=ARRAYFORMULA(IF(A1:A="";;A1:A+1000))
You can try this formula =ARRAYFORMULA(IF(ISBLANK(A1:A),"",(A1:A + B1:B))) if this works out for you.
Reference:
https://support.google.com/docs/answer/3093290?hl=en

Using regextract and importrange together make a "duplicate" formula

I have a spreadsheet where I look if the data (website) already exist on the master sheet.
=if(countif(importrange("Spreadsheet Key","Leads!N:N"),K2)>0,"COMPANY EXISTS!","")
But the above formula is not dynamic enough. If there are companies with co.uk and on the master sheet if it's registered under .com, it won't show "COMPANY EXISTS!"
So I changed to the formula to look for works after before and after "." on a website.
=ARRAYFORMULA(REGEXEXTRACT(UNIQUE(SUBSTITUTE(importrange("Spreadsheet Key","Leads!N:N"),"www.","")), "([0-9A-Za-z-]+)\."))
But it's not working if I try to incorporate with if and countif.
=if(COUNTIF(ARRAYFORMULA(REGEXEXTRACT(SUBSTITUTE(importrange("Spreadsheet Key","Leads!N:N"),"www.",""), "([0-9A-Za-z-]+)\."),L2:L)>0,"Company Exist!",""))
It shows 'Wrong number of arguments to IF. Expected between 2 and 3 arguments, but got 1 arguments'
Can anyone help me out on where I am making the mistake?
Spreadsheet link- https://docs.google.com/spreadsheets/d/1La3oOWiM5KpzRY0MLLEUQC25LzDuQlqTjgFp-VlS8Bo/edit#gid=0
Edited: Made a mistake beforehand, didn't specify on that cell its looking against
Your formula had a typo. You are not closing the Arrayformula and the Countif correctly (the array formula closing parenthesis should go before the , of the count if). So change this:
=if(COUNTIF(ARRAYFORMULA(REGEXEXTRACT(SUBSTITUTE(importrange("Spreadsheet Key","Leads!N:N"),"www.",""), "([0-9A-Za-z-]+)\."),L2:L)>0,"Company Exist!",""))
To this:
=if(COUNTIF(ARRAYFORMULA(REGEXEXTRACT(SUBSTITUTE(IMPORTRANGE("Spreadsheet Key","Leads!N:N"),"www.",""), "([0-9A-Za-z-]+)\.")),L3:L)>0,"Company Exist!","")
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)
try:
=ARRAYFORMULA(IFNA(IF(IFNA(REGEXEXTRACT(SUBSTITUTE(IMPORTRANGE(
"1bnz7Y_xVN9Jo80aCBBeMBMJBnMDHkbZQUWnmL20CRi8", "Leads!N:N"),
"www.", ), "([0-9A-Za-z-]+)\."))>0, "Company Exist!", )))

Google Sheets WENN Date and Checkbox

i'm trying to figure out, how I can get my formula working.
It's telling me I need a valid date.
So if i'm going for this :
J3=checkbox, D5=date formated with =today(), G5=number between 1-30
=WENN(J3=FALSE;D5+G5)
This works fine ( today() + 1-30 )
Now here comes the error :
=WENN(J3=FALSE;D5+G5;);WENN(J3=TRUE;D5+7;)
This does not work because now it's telling me I need the valid date.
So my question is, how I can get it work?
try like this:
=IF(D3=FALSE; A3+C3; A3+7)
for arrayformula use:
=ARRAYFORMULA(IF(A3:A="";;IF(D3:D=FALSE; A3:A+C3:C; A3:A+7))

XSL: nested <?choose?> in RTF Template

I'm having trouble getting my RTF template to accept a nested choose in my first cell. I have:
<?choose?>
<?when: FIRST_COLOR='Red'?>
<?FIELD_VALUE?>
<?end when?>
<?otherwise?>
<?choose?>
<?when: SECOND_COLOR?>
<?xdofx:FIELD_VALUE_2||'Z'?>
<?end when?>
<?otherwise?>
<?FIELD_VALUE_2?>
<?end otherwise?>
<?end choose?>
<?end otherwise?>
<?end choose?>
I also tried without the colon in the when statements, but instead of an error, I only get two out of 50 records.
I found that a nested if worked instead.
<?xdofx:if FIRST_COLOR='Red' then
FIELD_VALUE
else
if SECOND_COLOR!='' then
FIELD_VALUE_2||'Z'
else
FIELD_VALUE_2
end if?>
If your original example was the code you were actually using, you were missing colons. It should be:
<?otherwise:?>
That would cause an issue, but I cannot say whether it would have caused your issue since you did not specify the exact error you were getting.

Django Query in a loop fails for no good reason

I have this code:
msgs = int(post['time_in_weeks'])
for i in range(msgs):
tip_msg = Tip.objects.get(week_number=i)
it always results in an error saying that no values could be found.
week_number is an integer field. When I input the value of i directly,
the query works.
When i print out the value of i I get the expected values.
Any input at all would be seriously appreciated.
Thanks.
The range function will give you a zero based list of numbers up to and excluding msgs. I guess there is no Tip with week_number=0.
Also, to limit the number of queries you could do this:
for tip in Tip.objects.filter(week_number__lt=msgs):
#do something
or, if you want specific weeks:
weeks=(1,3,5)
for tip in Tip.objects.filter(week_number__in=weeks):
#do something