简体   繁体   English

比较Excel中row的第一个和最后一个值

[英]Compare first and last value of row in Excel

I've put together a table to track the success of some SEO efforts. 我整理了一张表格来跟踪一些SEO工作的成功。 For each row I'd like to compare the starting value with the most recent value. 对于每一行,我想将起始值与最新值进行比较。 We update this table each week, so it'd be great if it could dynamically reference the last non-blank space. 我们每周都会更新此表,因此,如果它可以动态引用最后一个非空白空间,那就太好了。

I tried this with Vlookup and Hlookup, but they both seem to only want to work vertically down the column. 我用Vlookup和Hlookup进行了尝试,但是它们似乎都只想垂直向下工作。

This is what I've got now, but again, it's looking up values in the column instead of the row. 这就是我现在所拥有的,但是再次,它是在列而不是行中查找值。

=VLOOKUP(C3+99,C5:C99,1)-C5

screenshot 截图

I'm new to this, so I'm feeling pretty lost. 我对此并不陌生,所以我感到很失落。

Try VBA. 尝试使用VBA。 It is good to learn, especially if you are doing any technical work (SEO results can be tricky to interpret). 学习非常好,特别是如果您正在做任何技术性工作(SEO结果很难解释)。

Here is an idea of the logic you could use for your first relatively simple VBA program: 这是您可以用于第一个相对简单的VBA程序的逻辑概念:

  1. Declare variables 声明变量
  2. Set up a loop. 设置一个循环。 Evaluate the value of each cell, and stop the loop when the contents are "". 评估每个单元格的值,并在内容为“”时停止循环。
  3. Take the cell value and store it in a variable. 取单元格值并将其存储在变量中。
  4. Compare the value of the dynamically-located last value with the first value (also stored in a variable). 将动态定位的最后一个值与第一个值(也存储在变量中)进行比较。 You could do mathematical operations (find the difference, or % variance) or boolean operations (return true/false if the values = each other). 您可以进行数学运算(查找差异或%方差)或布尔运算(如果值彼此相等,则返回true / false)。

Try this: 尝试这个:

=C5-OFFSET(C5,0,COUNTA(C5:AAA5)-1) = C5-OFFSET(C5,0,COUNTA(C5:AAA5)-1)

CountA counts the number of non-empty spaces and offset retrieves a value from a specified number of cells away. CountA计算非空空格的数量,偏移量从指定数量的单元格中获取一个值。

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

相关问题 在Excel中逐行比较值 - Row By Row Compare Value in Excel Excel VBA:如何将值粘贴到表的最后一行的第一个单元格中? - Excel VBA: How to paste a value in the first Cell of the last row of a table? 根据Excel中第一列的变量查找行的最后一个值 - Finding last value of row depending on the first column's variable in Excel 一个程序,它将在最后一行中找到具有最小值的列,并将其在第一行中的值分配给变量? [Excel VBA] - A program that will find the column with a minimum value in its last row and assign its value in the first row to a variable? [Excel VBA] 返回一行的最后一个值 - EXCEL - Return Last Value of a Row - EXCEL Google Spreadsheet / EXCEL]如何获取行中的最后一个值? 使用A1作为第一个单元格? - Google Spreadsheet/EXCEL] How do I get the last value in a Row? Using A1 as the first cell? Excel VBA-选择从第一行到最后一行的范围 - Excel VBA - selecting the range from first row to the last row 使用 MATLAB 或 Excel 将矩阵中的第一行替换为最后一行等 - Substituting first row by last row and so on in a matrix using MATLAB or Excel 查找连续具有特定值的第一个和最后一个条目 - finding the first and last entry with a certain value in a row 找到一行excel中最后一次出现的值 - Find the last occurrence of a value in a row excel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM