问题
I need help trying to figure out a combination google sheets formula
If
Cell B5 contains "Rct"
And
today's date is 30 days after the date defined in cell C5
And
if Cell D5 and D6 both says "2 weeks ago" or "1 week ago" or contains the words "day" "hour" or "minute"
(not sure if possible but instead of the all those words could if be if the text in cell D5 and D6 are the color "green" and or "Yellow")
Then
Cell H5 will say "Y" if the above conditions are met or "N" if they aren't
The following formula works for what I asked above
=ARRAYFORMULA(IF((REGEXMATCH(LOWER(B5:B29), "rct"))*
(TODAY()>C5:C29+30)*
(REGEXMATCH(LOWER(D5:D29), "2 weeks ago|1 week ago|day|hour|minute"))*
(REGEXMATCH(LOWER(E5:E29), "2 weeks ago|1 week ago|day|hour|minute")),
"Y", "N"))
However I am new to doing this coding stuff on the google sheets and I though I could add to that formula myself without troubling someone else.
Is there any way to add to that formula so that
If
Cell B5:B28 contains "cdt"
and
today's date is 60 days after the date defined in cell F5:F29
And
if Cell D5 and D6 both says "2 weeks ago" or "1 week ago" or contains the words "day" "hour" or "minute"
Then
Cell H5 will say "Y" if the above conditions are met or "N" if they aren't
as well as
If
Cell B5:B28 contains "pvt"
and
today's date is 90 days after the date defined in cell F5:F29
And
if Cell D5 and D6 both says "2 weeks ago" or "1 week ago" or contains the words "day" "hour" or "minute"
Then
Cell H5 will say "Y" if the above conditions are met or "N" if they aren't
回答1:
paste this in H5:
=ARRAYFORMULA(IF((REGEXMATCH(LOWER(B5:B), "rct"))*
(TODAY()>C5:C+30)*
(REGEXMATCH(LOWER(D5:D), "2 weeks ago|1 week ago|day|hour|minute"))*
(REGEXMATCH(LOWER(E5:E), "2 weeks ago|1 week ago|day|hour|minute")),
"Y", "N"))
UPDATE:
=ARRAYFORMULA(IF((((REGEXMATCH(LOWER(B5:B), "rct"))*(TODAY()>C5:C+30))+
((REGEXMATCH(LOWER(B5:B), "cdt"))*(TODAY()>C5:C+60))+
((REGEXMATCH(LOWER(B5:B), "pvt"))*(TODAY()>C5:C+90)))*
(REGEXMATCH(LOWER(D5:D), "2 weeks ago|1 week ago|day|hour|minute"))*
(REGEXMATCH(LOWER(E5:E), "2 weeks ago|1 week ago|day|hour|minute")),
"Y", "N"))
来源:https://stackoverflow.com/questions/59271856/regematch-if-and-and-date-combined-forumula