Spreadsheets are the most popular end-user programming so ware, where formulae act like programs and also have smells. One well recognized common smell of spreadsheet formulae is nested-IF expressions, which have low readability and high cognitive cost for users, and are error-prone during reuse or maintenance. However, end users usually lack essential programming language knowledge and skills to tackle or even realize the problem. e previous research work has made very initial a empts in this aspect, while no e ective and automated approach is currently available.is paper rstly proposes an AST-based automated approach to systematically refactoring nested-IF formulae. e general idea is two-fold. First, we detect and remove logic redundancy on the AST. Second, we identify higher-level semantics that have been fragmented and sca ered, and reassemble the syntax using concise built-in functions. A comprehensive evaluation has been conducted against a real-world spreadsheet corpus, which is collected in a leading IT company for research purpose. e results with over 68,000 spreadsheets with 27 million nested-IF formulae reveal that our approach is able to relieve the smell of over 99% of nested-IF formulae. Over 50% of the refactorings have reduced nesting levels of the nested-IFs by more than a half. In addition, a survey involving 49 participants indicates that for most cases the participants prefer the refactored formulae, and agree on that such automated refactoring approach is necessary and helpful. 2