Regematch if, and, and date combined forumula

醉酒当歌 提交于 2021-02-10 18:24:50

问题


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

Picture of my google sheet


回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!