简体   繁体   English

如何使Excel公式跳过空单元格

[英]How do I make an excel formula skip empty cells

I have a spreadsheet with data in a single row. 我有一个包含一行数据的电子表格。 The data is arranged by year with the earliest date in the right most cell and the latest date in the far left cell. 数据按年份排列,最早的日期在最右边的单元格中,最新的日期在最左边的单元格中。

What I need is a formula that will begin looking at the cells beginning on the right (earlier date) and move to the left toward a later date skipping the empty cells. 我需要的是一个公式,该公式将开始查看从右侧(较早的日期)开始的单元格,并向左移至较晚的日期,跳过空单元格。 As soon as it finds data in one of the cells I need it to stop and show the value in that cell. 一旦它在其中一个单元格中找到数据,我就需要它停止并显示该单元格中的值。

I have attached a picture as an example, in that picture I need it to begin at the cell for 2003 and begin moving left ignoring empty cells until it finds a cell with data. 我以图片为例,在该图片中,我需要它从2003年的单元格开始,并开始向左移动,忽略空白单元格,直到找到包含数据的单元格。 In this case the cell for 2005 contains data. 在这种情况下,2005年单元格包含数据。 I need it to copy that value ($2.43) and place it in the cell marked earliest value. 我需要它来复制该值($ 2.43)并将其放在标记为最早值的单元格中。

In the pictue I manually entered 2.43 in the cell for 2005 to show what i need.! 在图片中,我在2005年的单元格中手动输入了2.43,以显示我的需求。

在此处输入图片说明

You can use LOOKUP function to get the last value in a row, so if you have years in A1:J1 and dollar amounts in A2:J2 just use this formula to get the last numeric value from A2:J2 您可以使用LOOKUP函数获取行中的最后一个值,因此,如果您在A1:J1有年份,而在A2:J2美元金额,只需使用此公式从A2:J2获取最后一个数值

=LOOKUP(9.99E+307,A2:J2)

9.99E+307 is [almost] the largest value that Excel allows, when you use that "big num" as lookup value the result is the last number in the range 9.99E + 307 [几乎]是Excel允许的最大值,当您使用“大数”作为查找值时,结果是该范围内的最后一个数字

I made two ranges, starting E4 to J4, I place 1,2,3,4,5,6. 我做了两个范围,从E4到J4,我放置了1,2,3,4,5,6。 Below (thus range: E5-J5) I placed 6,5,4,3,2,1. 在下面(因此范围:E5-J5),我放置了6,5,4,3,2,1。

In a random cell I placed this formula: 在一个随机单元格中,我放置了以下公式:

=INDEX(E5:J5,MATCH(MIN(E4:J4),E4:J4,0))

This look in E4:J4 for the number that matched MIN(E4:J4), thus the lowest number. 在E4:J4中查找与MIN(E4:J4)匹配的数字,即最低的数字。 Then selects that value, matching the index, in the range E5:J5. 然后在范围E5:J5中选择与索引匹配的值。

As follows from your image - year should be less than 10 yr history . 如下所示,您的年份应该少于10年的历史 In that case try following formula (I suppose that your data ( years and values) are in B3:X4 range): 在这种情况下,请尝试使用以下公式(我想您的数据(年和值)在B3:X4范围内):

=HLOOKUP(MIN(IF((B4:X4<>"")*(B3:X3>YEAR(NOW())-10),B3:X3)),B3:X4,2,0)

Note, that it is an array formula, so you need to press CTRL + SHIFT + ENTER to evaluate it. 请注意,这是一个数组公式,因此您需要按CTRL + SHIFT + ENTER对其求值。


If you don't need to use condition year should be less than 10 yr history , just remove *(B3:X3>YEAR(NOW())-10) from the formula: 如果您不需要使用条件年份应少于10年的历史记录 ,只需从公式中删除*(B3:X3>YEAR(NOW())-10)

=HLOOKUP(MIN(IF(B4:X4<>"",B3:X3)),B3:X4,2,0)

and press CTRL + SHIFT + ENTER to evaluate it. 然后按CTRL + SHIFT + ENTER进行评估。

暂无
暂无

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

相关问题 Excel - 用于跳过空单元格的数组公式 - Excel - Array Formula to skip empty cells Excel:如何创建一个公式来对动态范围的单元格求和? - Excel: How do I create a formula to sum a dynamic range of cells? 如何使Excel的“ IF”公式将空白单元格计算为“ 0”? - How to make Excel “IF” formula calculate blank cells as “0”? 如何在单独的单元格中使用多个 IF 语句创建公式? - How do I make a formula with Mulitple IF statements in seperate cells? VBA:如何将公式应用于与非空单元格相邻的单元格? - VBA: How do I apply a formula to cells adjacent to non-empty cells? Excel-跳过空白表单元格公式 - Excel - Skip Blank Table Cells Formula 如何将Excel语句的大小减小为txt文件并跳过没有数据的空单元格 - How can I reduce the size of my statement for Excel to txt file and skip empty cells with no data 如何根据 VBA 或 Excel 公式中的单元格内容连接具有变化值的静态公式? - How do I CONCAT a static formula with a changing value based on a cells contents in VBA or an Excel formula? 在 excel 365 如何按顺序减去值但跳过空单元格 - In excel 365 how to subtract values sequentially but skip empty cells 如何在Excel中创建报告,以将空白单元格标记为“ n”,并将任何输入单元格标记为“ y”,以表示一系列单元格? - How do I create a report in Excel marking empty cells as “n” and cells with any input as “y” for a range of cells?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM