简体   繁体   中英

Export an excel sheet into csv while leaving out bottom rows with formulae but no data

I have an excel sheet (in a macros enabled excel file) that gets its data from other sheets. If there is no data to be shown, the cell would be empty (""). But the formula will still be there of course. Let's say SheetB gets data from SheetA, the formula in a cell on SheetB looks like this:

=IF(SheetA,A2="","","data")

So when I export/convert the sheet as a CSV, all the rows with no data but formula also get exported. I tried copy pasting the contents of SheetB into SheetC as values. I hoped that would get rid of the formulae. Even when there's no formulae there's still some information in the cells which causes them to get exported.

The only thing that works for me right now is to manually select and delete all the cells with no data but only formula. But it's time consuming as I have to do that to many files. And the number of rows with data differs from file to file. That's why I can't have a macro to delete rows after a specified row.

I've tried searching for solution for over 3 hours. I couldn't find anything. I'm sorry for the noob question.

Use a helper column and calculate the LEN of that cell. If it's 0, it means is blank (even if there is a formula inside, it will return 0). Then you can filter, and export to csv only those rows where LEN is not 0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM