title: PowerShell: Conditional CSV cell value
body: <p>In table.csv there are already columns named Enrolled and Status. There are other columns, but they are not relevant.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Enrolled</th>
  <th>Status</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>7/28/2021 13:37</td>
  <td>Unknown</td>
  </tr>
  <tr>
  <td>7/21/2021 13:37</td>
  <td>Unknown</td>
  </tr>
  <tr>
  <td>7/14/2021 13:37</td>
  <td>Unknown</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>If Enrolled date is less than 1 week ago from today, the Status cell is changed to PAST DUE</p>
  <p>If Enrolled date is greater than 1 week ago from today it becomes DISABLE</p>
  <p>If Enrolled date is greater than 2 weeks ago from today it becomes DISABLED STILL PAST DUE</p>
  <p>The end result should change table.csv to look like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Enrolled</th>
  <th>Status</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>7/28/2021 13:37</td>
  <td>PAST DUE</td>
  </tr>
  <tr>
  <td>7/21/2021 13:37</td>
  <td>DISABLE</td>
  </tr>
  <tr>
  <td>7/14/2021 13:37</td>
  <td>DISABLED STILL PAST DUE</td>
  </tr>
  </tbody>
  </table>
  </div>
  <pre><code>$csv = Import-Csv file.csv
  $pastdue = (Get-Date).AddDays(-7)
  foreach($i in $csv.Enrolled){
      if ($i -lt $pastdue){
          ???
      }
  }
  </code></pre>
  <p>I'm thinking the switch function may be useful, but not sure how to implement it.</p>