title: How to Delete a Cell Based if Another Cell Matches a Certain Value
body: <p>I am generating an excel sheet based off existing data, that the user can then modify/confirm.</p>
  <p>I have two columns, one being <code>Instructions</code> with the options of either <code>Pay</code> or <code>Do Not Pay</code> and another column labeled <code>Do Not Pay Reason</code> that has a drop down list of options.</p>
  <p>If a user changes the value of <code>Instructions</code> to <code>Pay</code> then I want the <code>Do Not Pay Reason</code> cell at that row to be cleared.</p>
  <p>I tried setting a string formula</p>
  <pre><code>cellBuilder.setStringFormula(&quot;IF(ISNUMBER(SEARCH(\&quot;Pay\&quot;, M&quot; + excelForumlaRowIndex + ,&quot;)), \&quot;\&quot; + &quot;, M&quot; + excelForumlaRowIndex + &quot;)&quot;);
  </code></pre>
  <p>But that does not work, because N$ is the cell value I am both trying to change and trying to keep. I have read that VBA is the only way to conditionally delete a cell value.</p>
  <p>I am extremely new with VBAs both within Excel and Apache POI and was hoping for some guidance on what a VBA for this situation would look like, and how to apply it using Apache POI. I would also be open to any other suggestions on how to get the functionality I am looking for without using VBAs.</p>