2014-02-24 124 views
0

的最小值我用这个:查找表包含特定细胞

=MIN(First:Last!H46) 
  • 结果中的最小 H46所有我的床单
  • 我需要找到这其中板材 *(即'05')*
  • 我需要使用第二个结果找到该表上的其他数据 *(即单元格H45仅在'05'表格上)*

我sheetnames是首先最后与一个月之间,例如天01,02,03

+0

这个问题可能很有趣:http://stackoverflow.com/questions/21131206/find-maximum-value-for-a-column-in-different-sheets-and-report-it-in -result玉树/ –

回答

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( “Sheet2的”, “Sheet4” ,B6)