如何在工作表为空白的工作表中的公式中保留Excel引用? [英] How to persist Excel References in formulas across worksheets where the worksheet is blank?

查看:132
本文介绍了如何在工作表为空白的工作表中的公式中保留Excel引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Excel中是否可以为其他命名的空工作表创建一个带有公式的模板,以使对单元格的引用始终保持不变,而不会像这样结束?

Is it possible in Excel to create a template with formula to other named empty sheets such that the references to the cells always remain and don't end up like this?

='Data'!#REF!

我正在使用python,pandas和openpyxl来填充具有各种pandas数据帧的多个命名工作表.第一,第二和第三页是模板,引用了其他工作表.

I am using python, pandas and openpyxl to populate multiple named worksheets with various pandas dataframes. The 1st, 2nd and 3rd sheets are templates with references to the other worksheets.

为什么要这样做::如果我在说10行的模板中有数据,并写了一个5行的数据框,则剩下的5条现有行将保留.

Why is this required : If I have data in the template of say 10 rows and write a dataframe of 5 rows the remaining 5 existing rows remain.

可能有可能在to_excel之前清除目标工作表,但我认为这可能会迫使链接断开.

It might be possible to clear the target sheet before the to_excel but I think this may force the links to break.

我已经看过了这个

I've looked at this How to preserve a formula's reference to a worksheet when the worksheet is deleted and replaced? but it seems quite tedious to have to create another indirect reference.

推荐答案

这是使用命名范围解决的.

This was solved using Named Ranges.

这篇关于如何在工作表为空白的工作表中的公式中保留Excel引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆