查找包含特定单元格最小值的工作表

时间:2014-02-24 14:09:32

标签: excel excel-formula relative

我用这个:

=MIN(First:Last!H46)
  • 结果是我所有工作表中最小的 H46
  • 我需要找到哪张表它是*(即'05')*
  • 我需要使用第二个结果来查找该表上的其他数据 *(例如,仅在表'05'上的单元格H45)*

我的工作表名称是 First Last ,其中包含两者之间的日期,例如 01,02,03

1 个答案:

答案 0 :(得分:0)

尝试这个小的用户定义函数:

Public Function WhereIsMin(s1 As String, s2 As String, r As Range) As String
    Application.Volatile
    Dim StartLooking As Boolean, sh As Worksheet, fformula As String
    Dim findit As Variant, addy As String
    addy = r.Address(0, 0)
    fformula = "Min(" & s1 & ":" & s2 & "!" & addy & ")"
    findit = Evaluate(fformula)
    StartLooking = False
    For Each sh In Worksheets
        If sh.Name = s1 Then StartLooking = True
        If sh.Name = s2 Then StartLooking = False
        If StartLooking Then
                If sh.Range(addy).Value = findit Then
                    WhereIsMin = sh.Name
                    Exit Function
                End If
        End If
    Next sh
End Function

在工作表中,您可以使用它:

<强> = WhereIsMin( “Sheet 2中”, “Sheet4”,B6)