简体   繁体   中英

Inverse LOOKUP in google sheets to return column name

Good day, I am currently sorting a storage unit, where various parts from samples are stored in multiple locations. The idea is to sort it. So I am creating a spreadsheet for each part. The columns will be the location and the rows are a list of the sample numbers of which the parts can be found in this location.

input:

输入

A spreadsheet like this will exist for every part.

The idea is to have a final table, sorted by sample number, which has the parts in the columns. I want the cells to return where this part of this sample is stored:

desired output:

期望的输出

I tried various LOOKUP formulas but they do not return the column name. Because this has to be accessible by multiple people, it has to be in google sheets. This is an example file: https://docs.google.com/spreadsheets/d/1pUmTs0mLoZAdPc83pLXC75MCUF2P1SHDtEfYPEMohr4/edit?usp=sharing I am super thankful for any help!

With the help of this website: https://infoinspired.com/google-docs/spreadsheet/search-across-columns-and-return-the-header/ I found a solution. The idea is to use match functions for each column. For the example posted the code looks like this:

=ifs(isna(match(A2,'Part 1'!$A$1:$A$7,0))=FALSE,'Part 1'!$A$1,isna(match(A2,'Part 1'!$B$1:$B$7,0))=FALSE,'Part 1'!$B$1,isna(match(A2,'Part 1'!$C$1:$C$7,0))=FALSE,'Part 1'!$C$1,isna(match(A2,'Part 1'!$D$1:$D$7,0))=FALSE,'Part 1'!$D$1)

I know it is not pretty, but it works, as the number of columns is limited. The website also suggests a dynamic solution with a query function, but that only works when the cell left of the cell of interest has entries.

Thanks to everyone:-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM