# If Then for cell value automatically delete row

Here’s what I want, I haven’t found a way to make it possible…

A1 is references a list of 2 items on sheet 2, the items being “0” and “delete”
cell A2 has the following code:
If A1 = “delete” then Delete Row
…So that the row (not necessarily row “1”, but a relative row… whichever row has the above code in it and the cell to the left of the cell with the code has “delete” in it…which is cells A1 and A2 in the above example)

Sorry if i’m repetitive and lame, I just really need to find the solution to this.

@Anonymous2 I’m sure it’s possible, but you’ll need to know how to write Macros first.

I think you should explain this with more details; I am pretty good with Calc but I am having trouble to understand what you are trying to do… or I should keep reading until it gets clear in my head

If I understood, the behavior that you want is a little bit difficult to reproduce automatically. It’s because, using your formula, whenever your spreadsheet was updated a new cell will be deleted. That’s how the things work on calc. If you change a single cell, all others cells will be recalculated, which in your case can mean keep deleting cells automatically and indefinitely.

I guess you can find in a different solution. Why do you not simply hide the cell’s content? I don’t know your problem, of course, so I’m only trying to work around it.

Make a copy of your sheet. Insert a new column at the start of the sheet (A - first column). Make an if-then that shows a 1 or some other value if the condition is met, and nothing if not. Then sort on that first column, expanding to all columns. The rows with empty first column value will be on top or bottom. You can delete them in one go.

If you need to reset the order to the previous state, you have to do some other tricks. Insert another column (B), first row (B1) enter value 1, then B2=B1+1. Then copy B2 to the rest of the column rows. Then insert another column (C). Paste the value of B to C, but make sure it copies the values (1,2,3,…), not the calculations. Then do the sorting of A, remove the empty A rows, then sort on C.