2014-02-24 122 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)