简体   繁体   English

列中与excel中另一列中的特定值相对应的值列表

[英]the listing of values in a column that correspond to a specific value in another column in excel

the source data is in the following format 源数据采用以下格式

    A   B
    1   0
    2   0
    4   1
    5   0
    6   0
    8   1

I originally intended to list the missing items in the column A but since that did not quite work out for me, I intend to achieve the same thing via the method I will propose now. 我原本打算在A列中列出缺失的项目,但是由于那对我来说还算不上什么,因此我打算通过我现在建议的方法实现同样的目的。

What I want is a list that goes 我想要的是一份清单

    C
    3
    7

essentially giving me the missing numbers of the sequence by using the values provided in the column B. But basically any solution that would give me the values listed under column C would be very appreciated. 本质上是通过使用B列中提供的值为我提供了序列的缺失编号。但是,基本上任何可以为我提供C列中列出的值的解决方案都是不胜感激的。

It should be noted that I am working with a large list so that manual filtering and such are not preferable. 应该注意的是,我正在处理大量清单,因此手动过滤等不是可取的。

In cell G4 enter an address you want to look in, for example A2:A5 and then use the array formula below. 在单元格G4中,输入要查找的地址,例如A2:A5 ,然后使用下面的数组公式。 The only assumption is that the list of numbers should begin from 1 . 唯一的假设是数字列表应从1开始。 I know it looks crazy, the formula. 我知道公式看起来很疯狂。 This formula has to be applied to range, so select a range, then go to address bar paste this formula and press CTRL + SHIFT + ENTER . 必须将此公式应用于范围,因此选择一个范围,然后转到地址栏粘贴此公式并按CTRL + SHIFT + ENTER In this particular case the range has to be in column shape. 在此特定情况下,范围必须为圆柱形状。

I left the formula as not formatted text, so it was easier to copy. 我将公式保留为未格式化的文本,因此更易于复制。

=IF(INT(SQRT(MMULT((IF(TRANSPOSE(MMULT(INDIRECT(G4),1+0*TRANSPOSE(ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))))))=MMULT(ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))),1+0*TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(INDIRECT(G4)))))),0,ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))))^2),1+0*ROW(INDIRECT("1:"&COUNTA(INDIRECT(G4)))))/COUNTA(INDIRECT(G4))))=SQRT(MMULT((IF(TRANSPOSE(MMULT(INDIRECT(G4),1+0*TRANSPOSE(ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))))))=MMULT(ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))),1+0*TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(INDIRECT(G4)))))),0,ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))))^2),1+0*ROW(INDIRECT("1:"&COUNTA(INDIRECT(G4)))))/COUNTA(INDIRECT(G4))),SQRT(MMULT((IF(TRANSPOSE(MMULT(INDIRECT(G4),1+0*TRANSPOSE(ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))))))=MMULT(ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))),1+0*TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(INDIRECT(G4)))))),0,ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))))^2),1+0*ROW(INDIRECT("1:"&COUNTA(INDIRECT(G4)))))/COUNTA(INDIRECT(G4))),"") = IF(INT(SQRT(MMULT((IF(TRANSPOSE(MMULT(INDIRECT(G4),1 + 0 * TRANSPOSE(ROW(INDIRECT(“ 1:”&MAX(INDIRECT(G4)))))))= MMULT( ROW(INDIRECT(“ 1:”&MAX(INDIRECT(G4)))),1 + 0 * TRANSPOSE(ROW(INDIRECT(“ 1:”&COUNTA(INDIRECT(G4)))))),0,ROW(INDIRECT( “ 1:”&MAX(INDIRECT(G4)))))^ 2),1 + 0 * ROW(INDIRECT(“ 1:”&COUNTA(INDIRECT(G4)))))/ COUNTA(INDIRECT(G4))))) = SQRT(MMULT(((IF(TRANSPOSE(MMULT(INDIRECT(G4),1 + 0 * TRANSPOSE(ROW(INDIRECT(“ 1:”&MAX(INDIRECT(G4))))))))= MMULT(ROW(INDIRECT( “ 1:”&MAX(INDIRECT(G4)))),1 + 0 * TRANSPOSE(ROW(INDIRECT(“ 1:”&COUNTA(INDIRECT(G4))))))),0,ROW(INDIRECT(“ 1:” &MAX(INDIRECT(G4)))))^ 2),1 + 0 * ROW(INDIRECT(“ 1:”&COUNTA(INDIRECT(G4)))))/ COUNTA(INDIRECT(G4))),SQRT(MMULT( (IF(TRANSPOSE(MMULT(INDIRECT(G4),1 + 0 * TRANSPOSE(ROW(INDIRECT(“ 1:”&MAX(INDIRECT(G4))))))))= MMULT(ROW(INDIRECT(“ 1:”&MAX (INDIRECT(G4)))),1 + 0 * TRANSPOSE(ROW(INDIRECT(“ 1:”&COUNTA(INDIRECT(G4))))))),0,ROW(INDIRECT(“ 1:”&MAX(INDIRECT(G4 )))))^ 2),1 + 0 * ROW(INDIRECT(“ 1:”&COUNTA(INDIRECT(G4)))))/ COUNTA(INDIRECT(G4))),“”)

The formula could be read as 该公式可以理解为

=IF(INT(A)=A,A, "")

where A is A在哪里

SQRT(MMULT((IF(TRANSPOSE(MMULT(INDIRECT(G4),1+0*TRANSPOSE(ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))))))=MMULT(ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))),1+0*TRANSPOSE(ROW(INDIRECT("1:"&COUNTA(INDIRECT(G4)))))),0,ROW(INDIRECT("1:"&MAX(INDIRECT(G4)))))^2),1+0*ROW(INDIRECT("1:"&COUNTA(INDIRECT(G4)))))/COUNTA(INDIRECT(G4)))

If column B is not needed (it can be computed from A ), assuming that you have the data on sheet named worksheet1 , the VBA sub that writes all the missing values to column C is the following: 如果不需要B列(可以从A进行计算),假设您有名为worksheet1数据,则将所有缺少的值写入C列的VBA子代码如下:

Sub worksheet1c()
    'this contains the position in column A
    Dim i As Integer
    'this contains the position in column C
    Dim j As Integer
    'the numbers from 1
    Dim number As Integer

    'initialization
    i = 1
    j = 1
    number = 1

    'check all numbers in column A from row 2
    Do While Sheets("worksheet1").Cells(i, 1).Value <> ""
        'if there is a difference between number and the value in cell write them to column C
        Do Until number = Sheets("worksheet1").Cells(i, 1).Value
            Sheets("worksheet1").Cells(j, 3).Value = number
            j = j + 1
            number = number + 1
        Loop
        i = i + 1
        number = number + 1
    Loop
End Sub

暂无
暂无

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

相关问题 根据与特定属性对应的另一个数组中的值对对象数组进行排序 - Sort array of objects based on values in another array that correspond to specific properties 如何在汇总另一个值的同时按特定项目/列的值对基于数组或列的数据进行分组? - How to group array or column based data by a specific item's/column's value while summing-up the values of another? 需要删除列中的单元格,如果数组中的值和另一列中的值存在 - Need to delete cells in a column, if the values in an array and the value in another column exist 将满足条件的数组值复制到另一列excel vba - copy Array values That Meet a Condition to another column excel vba 将数组值转换为 PySpark 中另一个数组值的列名 - Convert Array values into Column name for another Array value in PySpark Python:如果一列中的值等于另一列中的任何值,请将两个值都设为零 - Python: if a value in a column equals any value in another column, turn both values to zero 基于另一列的一列中的值计数 - Count of values in one column based on another column 根据另一个列条件过滤列值 - Filtering column values based on another column condition 按特定列对数组进行排序,然后按此列的值排序 - Sort array by specific column then sort by value of this column 如何在SQL中获取另一列等于值的一列中的值,并存储到PHP数组中? - How to get values in one column where another column equals a value with SQL, and store into an array in PHP?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM