首页 > 编程知识 正文

用公式查找一列中的重复项,excel找出某一列重复项

时间:2023-05-06 06:59:33 阅读:273189 作者:2947

excel查找一列重复项

How can you get the last number in an Excel column? I needed to do that in one of my sample files, so here's the formula that I used. Then, someone asked me how to get the last item (text or number) from a column, so there's a formula for that too.

如何获得Excel列中的最后一个数字? 我需要在一个示例文件中执行此操作,因此这是我使用的公式。 然后,有人问我如何从列中获取最后一个项目(文本或数字),因此也有一个公式。

带数字的栏 (Column with Numbers)

I'm updating my Excel Weight Tracker files, which were created long before Excel introduced named tables.

我正在更新我的Excel Weight Tracker文件 ,这些文件是在Excel引入命名表之前创建的。

Switching to tables has made it easier to show a summary on the dashboard. The old dynamic ranges aren't needed now - we can just refer to table columns instead.

切换到表格可以更轻松地在仪表板上显示摘要。 现在不再需要旧的动态范围-我们可以只引用表列。

The WeightData table, shown below, has columns where you enter the date and your weight every week.

如下所示,WeightData表具有用于输入日期和每周体重的列。

There is also a Dashboard sheet in the workbook, and I want the latest weight to show on the Dashboard.

工作簿中还有一个“仪表板”工作表,我希望最新的权重显示在仪表板上。

What formula would you use to show that latest weight on the Dashboard sheet? My formula is below, and you might use a different solution.

您将使用什么公式在“仪表板”表上显示最新重量? 我的公式如下,您可能使用其他解决方案。

获取最后的号码 (Get the Last Number)

The new dates and weights are entered at the end of the table, so I used the LOOKUP function on the Dashboard, to get the last number from the Weight column.

新的日期和权重在表的末尾输入,因此我使用了仪表板上的LOOKUP函数 ,从“权重”列中获取了最后一个数字。

=LOOKUP(9.99999999999999E+307, WeightData[Wt])

= LOOKUP(9.99999999999999E + 307,WeightData [Wt])

那是多少钱? (What's That Number?)

According to Excel's specifications, that strange number, 9.99999999999999E+307, is the largest number that can be typed into an Excel cell.

根据Excel的规范,该奇数9.99999999999999E + 307是可在Excel慈祥的橘子中键入的最大数字。

The LOOKUP function won't find that in the weight column (I hope!), so the formula returns the last number it finds in that column.

LOOKUP函数不会在权重列中找到该数字(我希望!),因此该公式将返回它在该列中找到的最后一个数字。

To see this formula, and all the others, get one of the Weight Tracker files - either the Pounds/Kilos version, or the Stone version.

要查看此公式以及所有其他公式,请获取一个Weight Tracker文件 -磅/公斤版本或石头版本。

提示–将该号码命名 (Tip – Name That Number)

Instead of putting that confusing number into the formula, you could define a name, using that value.

您可以使用该值定义一个名称 ,而不是将该混乱的数字放入公式中。

Then, put the "friendly" name into the formula, so you don't scare your co-workers.

然后,将“友好”名称放入公式中,这样您就不会吓到同事。

To create the name:

要创建名称:

Copy the number from the formula bar

从编辑栏中复制数字 On Excel's Formula tab, click Define Name

在Excel的“公式”选项卡上,单击“定义名称”

Type a name, e.g. XL_Max

输入名称,例如XL_Max

Leave the scope as Workbook

将范围保留为工作簿 Type a comment that explains what the number is

输入说明数字的注释 Right-click the Refers To box, and click Paste, then click OK

右键单击“引用到”框,然后单击“粘贴”,然后单击“确定”。 使用定义的名称 (Use the Defined Name)

After you define the name, use it in the formula.

定义名称后,在公式中使用它。

Select the cell with the LOOKUP formula, and click in the Formula bar.

选择具有“查找”公式的慈祥的橘子,然后单击“公式”栏中。 Select the long number, and replace it with the defined name, XL_Max

选择长号,并将其替换为定义的名称XL_Max Press Enter, to update the formula

按Enter键更新公式

Read more about Excel Names on my Contextures site.

在我的Contextures网站上了解有关Excel名称的更多信息 。

杂项列 (Column with Assorted Items)

In the previous formula, the LOOKUP function get the last number from a column. But how would you write a formula to get the last text or number in a column, which has assorted items, including blank cells and errors?

在上一个公式中, LOOKUP函数从一列中获取最后一个数字 。 但是,您将如何编写一个公式来获取一列中包含各种项目(包括空白慈祥的橘子和错误)的最后一个文本或数字

样本数据 (The Sample Data)

Here's the sample data, and the result in cell D2 should be "yes".  That's the last entry which either either a number or text.

这是示例数据,慈祥的橘子D2中的结果应为“是”。 那是数字或文本的最后一个条目。

What lookup formula would you use to get that result? My solution is below the screen shot.

您将使用什么查找公式来获得该结果? 我的解决方案是在屏幕截图下方。

With values (and blank cells) in cells B1:B6, I used this LOOKUP formula to get the last entry that's text or a number:

对于慈祥的橘子B1:B6中的值(和空白慈祥的橘子),我使用了此LOOKUP公式来获取最后一个文本或数字条目:

=LOOKUP(2,1/(B1:B6<>""),B1:B6)

= LOOKUP(2,1 /(B1:B6 <>“”),B1:B6)

检查空字符串 (Check for Empty Strings)

Here's how the formula works.

这是公式的工作方式。

First, the formula tests each entry to see if it's "not equal to" an empty string (<>"").

首先,该公式测试每个条目以查看其是否“不等于”一个空字符串(<>“”)。

The result of that test is TRUE (1) or FALSE (0) for each cell in the range.

对于该范围内的每个单元,该测试的结果为TRUE(1)或FALSE(0)。

除以结果 (Divide with the Result)

Then, the number 1 is divided by each TRUE/FALSE.

然后,将数字1除以每个TRUE / FALSE。

TRUE is equal to 1, and 1/1=1

TRUE等于1,且1/1 = 1 FALSE is equal to zero, and 1/0 results in a #DIV/0! error

FALSE等于零,1/0产生#DIV / 0! 错误 Any cells that contain an error will also return an error in this calculation

任何包含错误的慈祥的橘子也会在此计算中返回错误 查找查询值 (Find the Lookup Value)

The lookup value is 2, which won't be found, because the highest number is 1.

查找值是2,将不会找到,因为最大的数字是1。

Since it can't find a 2, the formula finds the position of the last number 1, and returns the value ("yes") at that location, in the lookup range.

由于找不到2,因此该公式将找到最后一个数字1的位置,并在查找范围内返回该位置的值(“是”)。

获取样本文件 (Get the Sample File)

To see the first LOOKUP formula, which returns the last number in a column, get my my Excel Weight Tracker files. There are versions for pounds/kilos, or for stone.

要查看第一个LOOKUP公式(返回一列中的最后一个数字),请获取我的Excel Weight Tracker文件 。 有磅/公斤或石头的版本。

翻译自: https://contexturesblog.com/archives/2019/05/16/excel-lookup-formula-for-last-item-in-column/

excel查找一列重复项

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。