Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
135 views
in Technique[技术] by (71.8m points)

indexing - Excel Index Match with 3 criteria but two columns could move

I have a large table of data but to make it simple using the following table how would I get "money" based on site and description? But here's the trick..the table is copied and pasted in the sheet and sometimes description,target and money are flipped around.

So how would I select a column using INDEX MATCH based on the header? Site is normally static in A:A but if there is a way to make that dynamic that would be amazing!!

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can use INDEX MATCH to return a column out of a table to pass into another INDEX MATCH

For your sample data try

=INDEX(INDEX($A:$Z,,MATCH(B14,$1:$1,0)),MATCH(C12,INDEX($A:$Z,,MATCH(B12,1:1,0)),0))

Ensure the inner INDEX range is large enough to cover your table wherever it is (I've used $A:$Z in this example)

Breaking it down, INDEX($A:$Z,,MATCH(B12,1:1,0)) returns the column containing the header value in cell B12 (Site in this case).

Similarly for INDEX($A:$Z,,MATCH(B13,$1:$1,0)) and money

Just make sure the labels in B12, B13 match the table headers exactly (ie Site, not site:)


Based on comment, to match site and description, try

=INDEX(INDEX($A:$Z,,MATCH(B14,1:1,0)),MATCH(1,(INDEX($A:$Z,,MATCH(B13,1:1,0))=C13)*(INDEX($A:$Z,,MATCH(B12,1:1,0))=C12),0))

entered as an array formula (press Ctrl-Shift-Enter rather than just Enter)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...