react中为nan_如何在Excel中为单元格区域分配名称

react中为nan

react中为nan

00_lead_image_name_on_range_of_cells

When creating formulas in Excel, you can reference cells from another part of the worksheet in your formulas. But if you have a lot of formulas, all those cell references can get confusing. There’s an easy way to remove the confusion.

在Excel中创建公式时,可以在公式中引用工作表另一部分的单元格。 但是,如果您有很多公式,那么所有这些单元格引用都可能会造成混淆。 有一个简单的方法可以消除混乱。

Excel includes a feature, called “Names”, that can make your formulas more readable and less confusing. Instead of referencing a cell or range of cells, you can assign a name to that cell or range and use that name in formulas. This will make your formulas much easier to understand and maintain.

Excel包含一个称为“名称”的功能,该功能可以使您的公式更具可读性,而不会造成混淆。 可以引用该单元格或范围的名称,然后在公式中使用该名称,而不是引用一个单元格或单元格的范围。 这将使您的公式更易于理解和维护。

In the formula below, we reference a range of cells (in bold) from another worksheet, called “Product Database”, in the same workbook. In this case, the name of the worksheet gives us a good idea as to what’s contained in the range of cells, “A2:D7”. However, we could use a name for this range of cells to make the formula shorter and easier to read.

在下面的公式中,我们引用同一工作簿中另一个工作表(称为“产品数据库”)的一系列单元格(粗体)。 在这种情况下,工作表的名称使我们对“ A2:D7”单元格区域中包含的内容有了一个很好的了解。 但是,我们可以为该单元格区域使用一个名称,以使公式更短且更易于阅读。

=IF(ISBLANK(A11),"",VLOOKUP(ALL,'Product Database'!A2:D7,2,FALSE))

NOTE: For more information about the VLOOKUP function used in the formula above, see our article about using VLOOKUP in Excel. You can also learn how to use the “IF” function and other useful functions.

注意:有关以上公式中使用的VLOOKUP函数的更多信息,请参见有关在Excel中使用VLOOKUP的文章。 您还可以学习如何使用“ IF”功能和其他有用的功能

01_using_cell_range_in_formula

如何使用名称框为单元格或单元格范围创建名称 (How to Create a Name for a Cell or a Range of Cells Using the Name Box)

To assign a name to a range of cells, select the cells you want to name. The cells don’t have to be contiguous. To select non-contiguous cells, use the “Ctrl” key when selecting them.

要将名称分配给一系列单元格,请选择要命名的单元格。 单元不必是连续的。 要选择不连续的单元格,请在选择它们时使用“ Ctrl”键。

02_selecting_cell_range

Click the mouse in the “Name Box” above the cell grid.

在单元格网格上方的“名称框”中单击鼠标。

03_name_box

Type a name for the range of cells in the box and press “Enter”. For example, we called the selected cells on our “Product Database” worksheet “Products”. There are syntax rules you must abide by when choosing a name. You can only begin a name with a letter, an underscore (_), or a backslash (\). The rest of the name can consist of letters, numbers, periods, and underscores. There are additional syntax rules about what’s valid and not when defining names.

在框中输入单元格范围的名称,然后按“ Enter”。 例如,我们将“产品数据库”工作表中的选定单元格称为“产品”。 选择名称时,必须遵守一些语法规则。 名称只能以字母,下划线(_)或反斜杠(\)开头。 名称的其余部分可以由字母,数字,句点和下划线组成。 还有其他关于有效的语法规则,而不是定义名称时的语法规则

04_entering_name_in_name_box

Remember the formula from the beginning of this article? It contained a reference to the “Products Database” worksheet in the workbook and a range of cells on the that worksheet. Now, that we created the “Products” name to represent the range of cells on our “Products Database” worksheet, we can use that name in the formula, shown in bold below.

还记得本文开头的公式吗? 它包含对工作簿中“产品数据库”工作表的引用以及该工作表上的一系列单元格。 现在,我们创建了“产品”名称来表示“产品数据库”工作表上单元格的范围,我们可以在公式中使用该名称,下面以粗体显示。

=IF(ISBLANK(A11),"",VLOOKUP(ALL,Products,2,FALSE))

NOTE: When creating a name using the “Name Box”, the scope of the name defaults to the workbook. That means that the name is available to be used on any worksheet in the current workbook without referencing a specific worksheet. You can choose to limit the scope to a specific worksheet so the worksheet name has to be used when referring to the name, such as in the example at the beginning of this article.

注意:使用“名称框”创建名称时,名称范围默认为工作簿。 这意味着该名称可用于当前工作簿中的任何工作表,而无需引用特定的工作表。 您可以选择将范围限制为特定的工作表,以便在引用名称时必须使用工作表名称,例如在本文开头的示例中。

16_using_name_in_formula

如何使用名称管理器编辑名称 (How to Edit Names Using the Name Manager)

Excel provides a tool, called “Name Manager”, that makes it easy to find, edit, and delete the names in your workbook. You can also use the Name Manager to create names, if you want to specify more details about the name. To access the Name Manager, click the “Formulas” tab.

Excel提供了一个名为“名称管理器”的工具,使您可以轻松地在工作簿中查找,编辑和删除名称。 如果要指定有关名称的更多详细信息,也可以使用名称管理器来创建名称。 要访问名称管理器,请单击“公式”选项卡。

05_clicking_formulas_tab

In the “Defined Names” section of the “Formulas” tab, click “Name Manager”.

在“公式”选项卡的“定义的名称”部分中,单击“名称管理器”。

06_clicking_name_manager

The Name Manager dialog box displays. To edit an existing name, select the name in the list and click “Edit”. For example, we’re going to edit the “Products” name.

将显示“名称管理器”对话框。 要编辑现有名称,请在列表中选择名称,然后单击“编辑”。 例如,我们将编辑“产品”名称。

07_clicking_edit_on_name_manager

The “Edit Name” dialog box displays. You can change the “Name” itself as well as add a “Comment” to the name, providing more details about what the name represents. You can also change the range of cells to which this name is assigned by clicking the “Expand Dialog” button on the right side of the “Refers to” edit box.

显示“编辑名称”对话框。 您可以更改“名称”本身,也可以在名称中添加“注释”,以提供有关名称表示的更多详细信息。 您还可以通过单击“引用”编辑框右侧的“扩展对话框”按钮来更改为其分配名称的单元格范围。

NOTE: You’ll see that the “Scope” drop-down list is grayed out. When you edit an existing name, you cannot change the “Scope” of that name. You must choose the scope when you first create the name. If you want the scope to be a specific worksheet, rather than the entire workbook, you can create a name in a way that allows you to specify the scope initially. We’ll show you how to do that in a later section.

注意:您会看到“范围”下拉列表显示为灰色。 编辑现有名称时,无法更改该名称的“范围”。 首次创建名称时,必须选择范围。 如果您希望范围是一个特定的工作表,而不是整个工作簿,则可以以一种允许您最初指定范围的方式创建一个名称。 我们将在后面的部分中向您展示如何做到这一点。

08_edit_name_dialog

As an example, say we added another product to our “Product Database” and we want to include it in the cell range named “Products”. When we click on the “Expand Dialog” button, the “Edit Name” dialog box shrinks down to contain only the “Refers to” edit box. We select the range of cells directly on the “Product Database” worksheet, including the row containing the newly added product. The worksheet name and cell range are automatically entered into the “Refers to” edit box. To accept your selection and return to the full “Edit Name” dialog box, click the “Collapse Dialog” button. Click “OK” on the “Edit Name dialog box to accept the changes to the name.

例如,假设我们在“产品数据库”中添加了另一个产品,并且希望将其包含在名为“产品”的单元格区域中。 当我们单击“展开对话框”按钮时,“编辑名称”对话框将缩小为仅包含“引用到”编辑框。 我们直接在“产品数据库”工作表上选择单元格范围,包括包含新添加的产品的行。 工作表名称和单元格范围将自动输入到“引用”编辑框中。 要接受选择并返回完整的“编辑名称”对话框,请单击“折叠对话框”按钮。 在“编辑名称”对话框上单击“确定”以接受对名称的更改。

08a_selecting_new_cell_range

如何使用名称管理器删除名称 (How to Delete a Name Using the Name Manager)

If you decide you don’t need a name anymore, it’s easy to delete it. Simply, access the “Name Manager” dialog box as we discussed in the previous section. Then, select the name you want to delete in the list of names and click “Delete”.

如果您决定不再需要名称,则可以轻松删除它。 只需访问上一节中讨论的“名称管理器”对话框即可。 然后,在名称列表中选择要删除的名称,然后单击“删除”。

09_deleting_name

On the confirmation dialog box that displays, click “OK” if you’re sure you want to delete the selected name. You are returned to the “Name Manager” dialog box. Click “Close” to close it.

如果确定要删除所选名称,则在显示的确认对话框中,单击“确定”。 您将返回到“名称管理器”对话框。 单击“关闭”将其关闭。

10_delete_confirmation

如何使用“新名称”对话框创建名称 (How to Create a Name Using the “New Name” Dialog Box)

When you create a new name by selecting one or more cells and then entering a name in the “Name Box”, the default scope of the name is the entire workbook. So, what do you do if you want to limit the scope of a name to just a specific worksheet?

通过选择一个或多个单元格然后在“名称框”中输入名称来创建新名称时,该名称的默认范围是整个工作簿。 因此,如果要将名称的范围限制为仅特定工作表,该怎么办?

Select the cells to which you want to assign the name. Click the “Formulas” tab and then click “Define Name” in the “Defined Names” section.

选择要为其分配名称的单元格。 单击“公式”选项卡,然后在“定义的名称”部分中单击“定义的名称”。

NOTE: You don’t have to select the cells first. You can also select them using the “Expand Dialog” button later on, if you want.

注意:您不必先选择单元格。 如果需要,您也可以稍后使用“扩展对话框”按钮选择它们。

12_clicking_define_name

The “New Name” dialog box displays. Notice that it’s very similar to the “Edit Name” dialog box mentioned earlier. The main difference is that now you can change the scope of the name. Say we want to limit the scope of the name to just the “Invoice” worksheet. We would do this if we wanted to be able to use the same name for a range of cells on another worksheet.

显示“新名称”对话框。 请注意,它与前面提到的“编辑名称”对话框非常相似。 主要区别在于,现在您可以更改名称的范围。 假设我们要将名称的范围限制为仅“发票”工作表。 如果我们希望能够对另一个工作表上的单元格区域使用相同的名称,则可以这样做。

First, we’ll enter the name we want to use, which in our case is “Products”. Remember the syntax rules when creating your name. Then, to limit the scope of the “Products” name to only the “Invoice” worksheet, we select that from the “Scope” drop-down list.

首先,我们将输入要使用的名称,在本例中为“产品”。 创建名称时,请记住语法规则。 然后,为了将“产品”名称的范围限制为仅“发票”工作表,我们从“范围”下拉列表中进行选择。

NOTE: The “New Name” dialog box can also be accessed by clicking “New” on the “Name Manager” dialog box.

注意:也可以通过在“名称管理器”对话框中单击“新建”来访问“新名称”对话框。

13_selecting_scope

Enter more details about the name, if desired, in the “Comment” box. If you didn’t select the cells to which you’re assigning the name, click the “Expand Dialog” button to the right of the “Refers to” edit box to select the cells the same way we did when we edited the name earlier. Click “OK” to finish creating the new name.

如果需要,在“注释”框中输入有关名称的更多详细信息。 如果您没有选择要为其分配名称的单元格,请单击“引用”编辑框右侧的“扩展对话框”按钮,以与我们之前编辑名称时相同的方式选择单元格。 单击“确定”完成新名称的创建。

14_clicking_ok_on_new_name_dialog

The name is automatically inserted into the same “Name Box” we used to assign a name to a range of cells at the beginning of this article. Now, we can replace the cell range reference (‘Product Database’!$A$2:$D:7) with the name (Products) in the formulas on the “Invoice” worksheet, like we did earlier in this article.

该名称会自动插入到我们在本文开头用于为一系列单元格分配名称的“名称框”中。 现在,我们可以像在本文前面所做的那样,在“发票”工作表的公式中用名称(产品)替换单元格范围引用(“产品数据库”!$ A $ 2:$ D:7)。

15_name_inserted_into_name_box

如何使用名称表示常数值 (How to Use a Name to Represent a Constant Value)

You don’t have to refer to cells when creating a name. You can use a name to represent a constant, or even a formula. For example, the worksheet below shows the exchange rate used to calculate the price in Euros for the various sizes of widgets. Because the exchange rate changes often, it would be useful if it was located in a place that’s easy to find and update. Since names are easy to edit, as discussed earlier, we can create a name to represent the exchange rate and assign a value to the name.

创建名称时无需引用单元格。 您可以使用名称表示常量,甚至可以表示公式。 例如,下面的工作表显示了用于计算各种尺寸的小部件的欧元价格的汇率。 因为汇率经常变化,所以如果汇率位于易于查找和更新的地方,将很有用。 如前所述,由于名称易于编辑,因此我们可以创建一个代表汇率的名称,并为该名称分配一个值。

17_exchange_rate_on_worksheet

Notice the formula contains an absolute cell reference to a cell containing the current exchange rate. We’d rather use a name that will refer to the current exchange rate so it’s easier to change and formulas using the exchange rate are easier to understand.

请注意,该公式包含对包含当前汇率的单元格的绝对单元格引用。 我们宁愿使用一个引用当前汇率的名称,以便更轻松地进行更改,并且更容易理解使用汇率的公式。

18_formula_with_cell_reference

To create a name that will be assigned to a constant value, open the “New Name” dialog box by clicking the “Formulas” tab and then clicking “Define Name” in the “Defined Names” section. Enter a name to represent the constant value, such as “ExchangeRate”. To assign a value to this name, enter an equal sign (=) in the “Refers to” edit box followed by the value. There should not be a space between the equal sign and the value. Click “OK” to finish creating the name.

要创建将分配给常量值的名称,请通过单击“公式”选项卡,然后在“定义的名称”部分中单击“定义的名称”,打开“新名称”对话框。 输入代表常数值的名称,例如“ ExchangeRate”。 要为此名称分配一个值,请在“引用”编辑框中输入一个等号(=),然后输入该值。 等号和值之间不应有空格。 单击“确定”完成名称的创建。

NOTE: If there’s a formula you use in many places in your workbook, you can enter that formula into the “Refers to” edit box so you can simply enter the name in every cell where you need to use the formula.

注意:如果您在工作簿的许多地方都使用了一个公式,则可以在“引用”编辑框中输入该公式,这样您就可以在需要使用该公式的每个单元格中简单地输入名称。

19_new_name_dialog_for_constant

Now, we can use the new name in formulas where we want to use the exchange rate. When we click on a cell with a formula that contains an absolute cell reference, notice the result is “0.00”. That’s because we removed the exchange rate from the cell being referenced. We’ll replace that cell reference with the new name we created.

现在,我们可以在要使用汇率的公式中使用新名称。 当我们单击具有包含绝对单元格引用的公式的单元格时,请注意结果为“ 0.00”。 这是因为我们从所引用的单元格中删除了汇率。 我们将用我们创建的新名称替换该单元格引用。

20_cell_reference_results

Highlight the cell reference (or other part of the formula you want to replace with a name) and start typing the name you created. As you type, any matching names display in a popup box. Select the name you want to insert into the formula by clicking on it in the popup box.

突出显示单元格引用(或要用名称替换的公式的其他部分),然后开始键入您创建的名称。 键入时,任何匹配的名称都会显示在弹出框中。 通过在弹出框中单击,选择要插入公式中的名称。

21_selecting_name

The name is inserted into the formula. Press “Enter” to accept the change and update the cell.

该名称将插入到公式中。 按“ Enter”接受更改并更新单元格。

22_name_inserted

Note that the result is updated using the exchange rate referred to by the name.

请注意,结果是使用名称所指的汇率更新的。

23_formula_using_constant_name

Names are very useful if you create complex Excel workbooks with a lot of formulas. When you need to distribute your workbooks to others, using names makes it easier for others, as well as yourself, to understand your formulas.

如果您使用许多公式创建复杂的Excel工作簿,则名称非常有用。 当您需要将工作簿分发给其他人时,使用名称可以使其他人以及您自己更容易理解公式。

翻译自: https://www.howtogeek.com/242652/how-to-assign-a-name-to-a-range-of-cells-in-excel/

react中为nan

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值