简体   繁体   English

如何基于另一个列中的唯一值获取Excel列的值

[英]How to grab the value of an excel column based on a unique value in another column

I have the following excel sheet and I'm trying to make a calculation that says how many of the courses are Live. 我有以下excel工作表,我正在尝试进行计算,说明有多少课程是在线的。 I have duplicate course values in rows so I need a way to say distinct courses and grab the delivery method tied to it. 我在行中有重复的课程值,因此我需要一种方法来说不同的课程并掌握与之相关的授课方法。

Course   Delivery_Method
16679    Live
16679    Live
16743    Live
16861    In-House

I'd like the output of the calculation to be: 我希望计算结果为:

Live Courses: 2

It may be important to note that 1 course will never have a live row and an in-house row. 可能需要注意的是,一门课程永远不会有现场直播和内部直播。 They will always be the same. 他们将永远是相同的。

There is probably a much better way to do it, but this is a roundabout method I have used before. 可能有更好的方法来执行此操作,但这是我以前使用的一种回旋方法。

It requires a second worksheet that does the calculations. 它需要第二个工作表来进行计算。 We will call your current sheet 'Sheet 1' and the Calculating sheet 'Sheet 2'. 我们将您当前的工作表称为“工作表1”,将计算工作表称为“工作表2”。 I am also calling [Course] 'Col A' and [Delivery_Method] 'Col B'. 我也叫[课程]'Col A'和[Delivery_Method]'Col B'。

On Sheet 2, create these Columns: 在工作表2上,创建以下列:

A. [Course] Copy from 'Sheet 1' and paste to 'Sheet 2' A. [课程]从“ Sheet 1”复制并粘贴到“ Sheet 2”

B. [Leave Blank] You will be creating a list in Column B that shows all items in Column A, but with no duplicates. B. [留空]您将在B列中创建一个列表,该列表显示A列中的所有项目,但没有重复项。 If there is anything in Column B, Clear Contents (see why below). 如果B列中有任何内容,请清除目录(请参阅下面的原因)。 Select Col A. On the Data tab, select Advanced. 选择“列A”。在“数据”选项卡上,选择“高级”。 Click 'Copy to another location', at 'Copy to:' enter '$B:$B' Click 'Unique records only'. 单击“复制到另一个位置”,在“复制到:”中输入“ $ B:$ B”。单击“仅唯一记录”。 Click 'OK'. 点击“确定”。 Col B should now be populated. B列现在应该已填充。

Why you need to clear Col B: 1) The filter likes to drop the existing header in, so if that space is occupied, you'll get an error message; 为什么需要清除B列:1)过滤器喜欢放入现有的标头,因此如果占用了该空间,则会收到一条错误消息; 2) if your new sorted list is shorter than your old sorted list, then you'll end up with extra fields at the bottom that are from your old list. 2)如果您的新排序列表比旧排序列表短,那么您将最终在底部找到旧列表中的额外字段。

One more thing - If you ever use this feature again, you need to know that it can only be done within the same sheet. 还有一件事-如果您再次使用此功能,则需要知道它只能在同一张纸上完成。 You can't use a 'Copy To' location that's on another sheet or document. 您不能使用另一张纸或文档上的“复制到”位置。

C. [Live] Enter this formula in all cells: =CountIfs([Sheet1!A:A,Bb2,'Sheet 1'!B:B,"Live") C. [实时]在所有单元格中输入此公式:= CountIfs([Sheet1!A:A,Bb2,'Sheet 1'!B:B,“ Live”)

D. [In-House] Enter this formula in all cells: =CountIfs([Sheet1!A:A,B2,'Sheet 1'!B:B,"In-House") D. [内部]在所有单元格中输入以下公式:= CountIfs([Sheet1!A:A,B2,'Sheet 1'!B:B,“ In-House”)

E. [Total Live] In row 2, enter: =Sum[$C:$C] E. [总计]在第2行中,输入:= Sum [$ C:$ C]

F. [Total In-House] In row 2, enter: =Sum[$D:$D] F. [内部总人数]在第2行中,输入:= Sum [$ D:$ D]

You can also just do an auto-sum at the bottom of your [Live] and [In-House] Columns instead of using columns E and F. 您也可以只在[实时]和[内部]列的底部进行自动求和,而不用使用E和F列。

Each time you do this, you should double-check the bottom of the list to be sure you have formulas to match all of the lines populated in Col B. 每次执行此操作时,都应仔细检查列表的底部,以确保您具有与列B中填充的所有行匹配的公式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何根据另一列中的重复项修改列并在 Excel 中保留唯一值 - How to amend a column based on duplicates in another and leave a unique value in Excel 如何基于 Excel 中的另一个列值对列值应用限制 - How to apply restriction on a column value based on another column value in Excel 如何在Excel中基于另一个列值连接一个列值? - How to concatenate a column value based on another column value in excel? Excel-基于附加列的唯一值 - Excel - Unique value based on additional column 如何基于Excel中的另一个列值计算列的值? - How to calculate the value of a column based on another column values in Excel? 如何基于Excel中另一列中的值替换字符串中的值 - how to replace value in a string based on value in another column in excel 如何根据另一列中的最新唯一日期获取单元格的值? - How to get value of a cell based on latest unique date in another column? 如何根据 Excel 中的一列和另一列中的第 n 个值的条件查找列中的值? - How to find value in column based on criteria from one column and nth value in another column in Excel? 根据另一列中的值求和一列中的值-Excel 2013 - Sum the value in one column based on the value in another column - excel 2013 excel根据另一列中的值增加列中的值 - excel increment a value in column based on value in another column
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM