Joana Marie Alcantara
Joana Marie Alcantara

Reputation: 13

GOOGLE SHEET FORMULA spreadsheet

is there a way, if I want to highlight the cell if the date is current week, past week and next week ?

Upvotes: 0

Views: 54

Answers (2)

player0
player0

Reputation: 1

see WEEKNUM():

enter image description here


try:

past

=(WEEKNUM(A1, 2)<WEEKNUM(TODAY(), 2))*(A1<>"")

present

=(WEEKNUM(A1, 2)=WEEKNUM(TODAY(), 2))*(A1<>"")

future

=(WEEKNUM(A1, 2)>WEEKNUM(TODAY(), 2))*(A1<>"")

to look only one week into past & future you can do:

past

=(WEEKNUM(A1, 2)<WEEKNUM(TODAY(), 2))*(WEEKNUM(A1, 2)=WEEKNUM(TODAY(), 2)-1)*(A1<>"")

future

=(WEEKNUM(A1, 2)>WEEKNUM(TODAY(), 2))*(WEEKNUM(A1, 2)=WEEKNUM(TODAY(), 2)+1)*(A1<>"")

enter image description here

Upvotes: 0

Osm
Osm

Reputation: 2881

Since you didn't include your Minimal, Reproducible Example, I created one to demonstrate.

Select the date range, in this case A2:A1000 and Go to Format > and then Conditional formatting. Under format rules choose: Custom formula is, And paste this formulas for each rule.

Rules Formulas
Prev week =AND(A2>WORKDAY(TODAY()-14, 7)-7,A2<WORKDAY(TODAY()-14, 7))
This week =AND(A2>WORKDAY(TODAY()-14, 7),A2<=WORKDAY(TODAY()-14, 7)+6)
Next week =AND(A2>WORKDAY(TODAY()-14, 7)+7,A2<WORKDAY(TODAY()-14, 7)+14)

enter image description here

enter image description here

Upvotes: 1

Related Questions