Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

Google Sheet formula error when added further condition

Trying to add a condition in the following formula that IF(F3:F<DATE(2020,6,30),13 whenever i tried to add it gives me an error.

Your help will be highly appreciated

=ArrayFormula(if(len(G3:G),ROUND(IF(LEN(F3:F),IF(G3:G="Confirmed",13 - MONTH(DATEVALUE(TEXT(F3:F,"mmm")&" 1"))) * 13/12,IF(G3:G="Probation",0)))),""))

I broken the formula and make it work for me but how to do the same thing with above one

=IF(AND(F3:F<DATE(2020,6,30),G3:G="Confirmed"),13,(13 - MONTH(DATEVALUE(TEXT(F3:F,"mmm")&" 1"))) * 13/12
)

Sheet link https://docs.google.com/spreadsheets/d/1IGSRMfqDODklJdPS4_TIMlIZJSM2JXqf_4pWOGjav4I/edit#gid=0

question from:https://stackoverflow.com/questions/65922778/google-sheet-formula-error-when-added-further-condition

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Issues

1.) You placed your "Probation" condition outside an IF statement does generating the error of "Wrong number of arguments..."

2.) AND formula cannot be used inside an ARRAYFORMULA because it will end the whole array together which will generate unexpected result.

Solution

1.) You can place your "Probation" condition before the "Confirmed"&DATE condition right after the IF(LEN(F3:F)..

2.) Instead of using AND. You can multiply both conditions which will return 1 if both conditions are TRUE.

You can use the formula below. This is working as expected on my end:

=ArrayFormula(if(len(G3:G),ROUND(IF(LEN(F3:F),IF(G3:G="Probation",0,IF(F3:F<DATE(2020,6,30)*(G3:G="Confirmed"),13,(13 - MONTH(DATEVALUE(TEXT(F3:F,"mmm")&" 1"))) * 13/12))),"")))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...