You have to login in order to post a reply to this topic.

5 replies [Last post]
baz
User offline. Last seen 37 weeks 4 days ago. Offline
Joined: 11/12/2009
Posts: 47

I have some data with multiple columns and rows in excel. If a certain cell is below a threshold, I want to delete the entire record by deleting the row. How can I do this?

 

All the best

 

Barry

codex
codex's picture
User offline. Last seen 18 weeks 4 days ago. Offline
Joined: 11/12/2009
Posts: 161
Re: If Cell < X, Delete Row

Do you want the boring or the cool answer to this question? I can only provide one at a time! Here we go:

1) Boring Answer
Well, the obvious way of automating this task is the boring one:
- Read the data from Excel.
- Loop through each data row (I would do it with the "Loop" action since indexers will proove really useful).
- Check the contents of column X (the column that contains the cell-in-question) and determine through a conditional if the number is greater than the threshold.
- If it is not, just write %""% to every cell of the specific row.

Then, the only thing that you have to do, is open the Excel, select all your data, press F5 (Go To Window Pops Up), hit the "Special" button, then select Blanks and hit the OK button. Then depending on the version of Excel that you have, you will need to select Edit, Delete, select the Entire Row option and click OK (office 2003) or on the Home ribbon under cells category you will have to select Delete - Delete Cells - Entire row.

Pretty easy solution but also really boring. Brb with the really COOL solution! (need to create a job for it)

__________________

Error is not blindness, error is cowardice

__________________

Error is not blindness, error is cowardice

codex
codex's picture
User offline. Last seen 18 weeks 4 days ago. Offline
Joined: 11/12/2009
Posts: 161
Re: If Cell < X, Delete Row

By the way, here is a sample job with a sample Excel sheet for the boring version of the job... It does everything that I mentioned above (I built based on the assumption that we are talking about Office 2007, but it shouldn't be much different for Office 2003)

AttachmentSize
boo.xlsx 17.57 KB
ParseExcel.waj 18 KB
__________________

Error is not blindness, error is cowardice

__________________

Error is not blindness, error is cowardice

baz
User offline. Last seen 37 weeks 4 days ago. Offline
Joined: 11/12/2009
Posts: 47
Re: If Cell < X, Delete Row

Brilliant Codex...thanks. Can't wait to see the cool version of this.

 

All the best

 

Barry

abraham
abraham's picture
User offline. Last seen 4 weeks 1 day ago. Offline
Joined: 12/01/2011
Posts: 7
Re: If Cell < X, Delete Row

 where's the cool verison????

Samantha
Samantha's picture
User offline. Last seen 8 hours 50 min ago. Offline
Joined: 04/23/2010
Posts: 1349
Re: If Cell < X, Delete Row

Well.. looking back at that time 2009 version 2.0 was released! From that time, to today, I reckon that a lot of changes have taken place. I hope you're running the latest version Abraham

:)
Samantha

__________________

Rome wasn't built in a day..

__________________

Rome wasn't built in a day..