Home

Help with if function and conditional formatting for dates

%3CLINGO-SUB%20id%3D%22lingo-sub-992962%22%20slang%3D%22en-US%22%3EHelp%20with%20if%20function%20and%20conditional%20formatting%20for%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-992962%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I%20am%20putting%20together%20a%20spreadsheet%20to%20track%20and%20manage%20contracts%20and%20I'm%20stuck%20on%20the%20following%20items%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3EColumn%20I%3C%2FSTRONG%3E%20-%20Conditional%20formatting%20by%20date%2C%20based%20on%20the%20information%20in%20AA-AC%3C%2FP%3E%3CP%3E%3CSTRONG%3EColumn%20J%3C%2FSTRONG%3E%20-%20Length%20of%20contract%2C%20I%20believe%20I%20need%20an%20IF%20statement%20here.%26nbsp%3B%20I%20would%20like%20results%20only%20to%20show%20if%20there%20is%20a%20date%20in%20both%20project%20start%20date%20and%20expiration%20date.%3C%2FP%3E%3CP%3EMany%20thanks!%26nbsp%3B%20Amy%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-992962%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-997213%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20with%20if%20function%20and%20conditional%20formatting%20for%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-997213%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F419667%22%20target%3D%22_blank%22%3E%40alv09%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'd%20apply%20such%203%20rules%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20775px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F155949iD7CFCFD6DBD8595B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eformula%20for%20the%20first%20one%20is%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3D(%24I4%26gt%3B(TODAY()%2B%24AB%248))*(%24I4%26gt%3B1)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Erest%20are%20similar.%3C%2FP%3E%0A%3CP%3EFor%20the%20contract%20length%20it%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIF((%5B%40%5BProject%20Start%20Date%5D%5D%26gt%3B1)*(%5B%40%5BExpiration%20Date%5D%5D%26gt%3B1)%2C%0A%20%20%20%20DATEDIF(%5B%40%5BProject%20Start%20Date%5D%5D%2C%20%5B%40%5BExpiration%20Date%5D%5D%2C%20%22Y%22)%20%26amp%3B%20%22years%20%22%20%26amp%3B%0A%20%20%20%20DATEDIF(%5B%40%5BProject%20Start%20Date%5D%5D%2C%5B%40%5BExpiration%20Date%5D%5D%2C%22YM%22)%20%26amp%3B%22months%20%22%20%26amp%3B%0A%20%20%20%20DATEDIF(%5B%40%5BProject%20Start%20Date%5D%5D%2C%5B%40%5BExpiration%20Date%5D%5D%2C%22MD%22)%20%26amp%3B%20%22days%22%2C%0A%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Highlighted
alv09
Visitor

Hi, I am putting together a spreadsheet to track and manage contracts and I'm stuck on the following items:

Column I - Conditional formatting by date, based on the information in AA-AC

Column J - Length of contract, I believe I need an IF statement here.  I would like results only to show if there is a date in both project start date and expiration date.

Many thanks!  Amy

1 Reply

@alv09 

I'd apply such 3 rules

image.png

formula for the first one is

=($I4>(TODAY()+$AB$8))*($I4>1)

rest are similar.

For the contract length it could be

=IF(([@[Project Start Date]]>1)*([@[Expiration Date]]>1),
    DATEDIF([@[Project Start Date]], [@[Expiration Date]], "Y") & "years " &
    DATEDIF([@[Project Start Date]],[@[Expiration Date]],"YM") &"months " &
    DATEDIF([@[Project Start Date]],[@[Expiration Date]],"MD") & "days",
"")