New-ConditionalText and formating a range with a date less than or between or greater than #1510
Replies: 2 comments 3 replies
-
Thanks for using ImportExcel. Don't know. Can you do it manually? Can you post an xlsx file that works the way you want? We can unzip it and inspect the XML to see what works. |
Beta Was this translation helpful? Give feedback.
-
HEllo : I hope thiis helps |
Beta Was this translation helpful? Give feedback.
-
Can New-ConditionalText format a range with a date less than or between or greater than? I can't find a way to work with conditionaltext to format a column based on the datetime value within the column.
Here are examples of what I've tried:
$format = New-ConditionalText -ConditionalType LessThanorEqual -Text Today Black Red -Range "G:G"
Formats the whole column including the header.
$format = New-ConditionalText -ConditionalType ContainsText -Text '2015' Black Red -Range "G:G"
Nothing gets formatted in the column.
$format = New-ConditionalText -ConditionalType LessThanOrEqual -Text $(Get-Date -Format 'yyyy/MM/dd') Black Red -Range "G:G"
All values in the column get formatted but the header is left alone.
$format = New-ConditionalText -ConditionalType LessThanOrEqual -Text $(Get-Date -Format 'yyyy/MM/dd h:mm') Black Red -Range "G:G"
Same result as the one before.
Here is some sample data that I'm trying to color code:
10/13/2026 0:00 10/9/2018 0:00 10/9/2018 0:00 10/9/2018 0:00 1/9/2024 0:00 1/13/2015 0:00 1/9/2024 0:00 1/9/2024 0:00 1/11/2022 0:00 1/11/2022 0:00 1/9/2024 0:00
The goal is to color code dates prior to today with red background, dates that are today up to a year in the future with a yellow background and dates beyond that with a green background.
I've spent the whole day trying to find a way to make this work, so I don't have to edit the spreadsheet to add formatting. Any assistance is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions