【问题标题】:Google spreadsheet - show an empty cell in a cell reference after exporting as excelGoogle 电子表格 - 导出为 excel 后在单元格引用中显示一个空单元格
【发布时间】:2020-08-10 13:40:56
【问题描述】:

考虑一个包含“源”电子表格和“格式化”工作表的电子表格 格式化工作表引用源工作表中的数据。

实现这一点的理想方法是使用数组公式

# formatted-sheet (formulas)
| title | description |
------------------------
| = ArrayFormula(source!A2:AA) | |
| | |
| | |

# source (raw data)
| title | description |
------------------------
| SomeTitle | long description |
| OtherTitle | Other description |
| emptyDesc | |

在 google 电子表格中,生成的格式化工作表显示如下:

# formatted-sheet (rendering formulas)
| title | description |
------------------------
| SomeTitle | long description |
| OtherTitle | Other description |
| emptyDesc | |

但是导出为Excel格式后,空值显示为“0”

# formatted-sheet (rendering formulas)
| title | description |
------------------------
| SomeTitle | long description |
| OtherTitle | Other description |
| emptyDesc | 0 |
| 0 | 0 | # for every additional line captures by the array formula, zeroes everywhere

我为此找到的解决方法是使用 IF 检查空字符串值

# formatted-sheet (formulas)
| title | description |
------------------------
| = ArrayFormula(IF(source!A2:AA = ""; ""; source!A2:AA)) | |
| | |

但是,如果单元格长度超过 255 个字符,IF() 公式会被破坏,是否有不同的解决方法? 敌人示例一种在导出到 xlsx 并使用 Microsoft Excel 打开后将空字符串显示为“0”的方法?还是改进公式?

这是参考for a sample sheet

【问题讨论】:

    标签: excel google-sheets


    【解决方案1】:

    尝试使用:

    =ARRAYFORMULA(IF(NOT(ISBLANK(source!B2:B)),source!A2:AA,""))

    它还隐藏了最后一个“emptyDesc”。如果这不是您的意图,请告诉我。

    【讨论】:

      【解决方案2】:

      我从this question 发现了这个技巧,它非常简洁,可以将所有内容转换为类似文本的格式。

      =ArrayFormula(source!A2:AA & "")
      

      但是它很可能会破坏数字格式和互操作性,我没有对此进行广泛的测试,因为在当前状态下它对我来说很好

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-12-25
        • 1970-01-01
        • 1970-01-01
        • 2011-11-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多