簡體   English   中英

Excel:編寫使用索引/匹配的公式,然后檢查相關單元格的值,並在發現錯誤時研究下一個匹配項

[英]Excel: Writing a formula that uses Index/Match then checks a related cell for a value and researches for the next match if it finds an error

這是我快速制作的試算表,用以解釋問題。

我需要在C列中有一個公式,該公式可以轉到第二張工作表並刪除數據,但是如果D列中出現錯誤,我需要它返回並搜索下一個匹配項,直到不再有N /一個值,或者一旦它搜索了數據庫,就會產生一條消息“未使用”。 在我的實際項目中,我在三組列中有25,000行,所以很遺憾,我無法真正手動完成。

我目前的公式嘗試:

= INDEX(數據庫!$ A $ 2:$ A $ 5,MATCH(B3,數據庫!$ B $ 2:B $ 5,0),IF(ISERROR(D3),INDEX('數據庫'!$ A $ 2:$ A $ 5, MATCH(B3,'組件數據庫'!B $ 2:$ B $ 5,0)+2),“”

我已經嘗試了其他一些IF / IFERROR / IFISERROR,但是它們都導致了無限循環或只是使用“ + 1,+ 2等”時在一定數量行之前的隨機值。 匹配功能之后。

任何幫助是極大的贊賞!

如果使用IFERROR ,則可以“嵌套”多個公式,以便它們連續運行直到成功為止,例如

=IFERROR(INDEX/MATCH1,IFERROR(INDEX/MATCH2,IFERROR(INDEX/MATCH3,"No matches)))

INDEX/MATCH 1, 2 and 3替換為實際公式(不包括=

這將使您從第一個公式中得到結果.....除非是錯誤,在這種情況下您將從第二個公式中得到結果。...除非是錯誤,在這種情況下您將從公式3中得到結果。 ..除非這是錯誤,在這種情況下,您會收到“沒有匹配項”。 您可以多次嵌套(最多64個)

最終使它在此格式下可以更深入地工作兩個級別。

=IF(
  AND(
    INDEX(*Table with value you want returned*, 
    MATCH(*Specific Cell*, *Table to search for cell*, 0)), 

  ISERROR(
    INDEX(*Table of hidden helper column with first result when value is searched*, 
    MATCH(*Cell to see if there is an error*, *Table with return value*, 0)))), 
        IFERROR(
            INDEX(*Table with value you want returned*,
            SMALL(
                IF(*Column*=*Value to be matched in column*,
                    ROW(*Column with matched value*)-ROW(*First Cell of Column with matching value*)+1,
                    ROW(*Last cell in Match Column*)+1),*which match you want returned (1st, 2nd, 3rd, etc... (in 1, 2, 3, etc. format))*),1),  

  INDEX(*Table with value you want returned*, 
  MATCH(*Specific Cell*, *Table to search for cell*, 0))))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM