Skip to content
Advertisement

Office Scripts Delete Entire Rows Based on Multiple Data in Certain Cells

I am a non-programmer and quite new to Office Scripts and I would love some help.

I am currently trying to delete entire rows if the cell in the “Change Flag” column, which happens to be the second column on the Excel sheet, contains the word “Delete” or “Deleted”.

I managed to delete rows if they contain the word “Delete” with the following script but could not make the script cells with “Deleted” too. I tried throwing brackets in there but it unfortunately did not work.

Can someone suggest a best practice to handle the deletion of rows based on multiple text matches (delete if x = y OR z)?

JavaScript

Advertisement

Answer

Your if statement should look like the below:

JavaScript

If you are looking for more general tutorials, here is a page I found that explains if statements a little more: https://www.w3schools.com/jsref/jsref_if.asp

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement