[英]Indexing data from another sheet based on drop down list selection
I've got 2 sheets. 我有两张纸。 Sheet1 and sheet2 for this lets call them.
为此,Sheet1和Sheet2可以调用它们。 Cell E3 to X3 will have the formula(with the exception of N3 and O3).
单元格E3至X3将具有公式(N3和O3除外)。 Column B has the names to check from B3 onward.
B列具有从B3开始要检查的名称。 Shee2 has the exact same layout as sheet1 so values/locations are same in sheet1 as sheet2.
Shee2具有与sheet1完全相同的布局,因此sheet1中的值/位置与sheet2相同。 Each row(which has 2 merged rows(so B3/B4 merged together etc)) in Column B in sheet1 is a drop down list of all the names in Column B from sheet2.
在sheet1的B列中的每一行(具有2个合并的行(因此B3 / B4合并在一起,等等))是sheet2的B列中所有名称的下拉列表。 The situation (assumes all info for sheet2 already inputted): Name selected from drop down list in B3, E3 checks B3 for a name.
情况(假定已经输入了sheet2的所有信息):从B3的下拉列表中选择名称,E3检查B3的名称。 E3 then checks for match in column B (from B3) from sheet2.
然后,E3检查工作表2中B列(来自B3)中的匹配项。 E3 then pulls all the data from row 3 in sheet2 and inputs into relevant columns(E3 to X3(with the exception of N3 and O3)).
然后,E3从sheet2的第3行提取所有数据,并将其输入到相关列中(E3至X3(N3和O3除外))。
I had a code for how I was doing it earlier when it was in the same sheet. 当它在同一张纸上时,我有一个代码来说明之前的操作方式。 But I've changed how I want to do it and now it's in a separate sheet.
但是我已经更改了操作方式,现在放在另一张纸上。 Before it was checking if the value of B3 matched the value of any other row in Column B and simply taking the data it had there into it's own.
在检查B3的值是否与B列中任何其他行的值匹配之前,只需将其中的数据放入自己的数据中即可。 But now it's in a separate sheet it works a bit different I think.
但现在在单独的工作表中,我认为它的工作原理有所不同。 I tried adding the sheet name in front of the column values in hope of it working but of course it did not.
我尝试将工作表名称添加到列值之前,以希望它能正常工作,但当然没有。
=IF(COUNTIF($B:$B,$B3)>1,INDEX(E:E,MATCH($B3,$B:$B,0)),"")
I also tried changing it to just an IF column B in sheet2 = B3 then index but didn't work but I probably didn't do it right. 我还尝试将其更改为Sheet2 = B3中的IF列B,然后进行索引,但是没有用,但是我可能做得不好。 Any ideas?
有任何想法吗?
If I understand your problem properly and referring to your previous questions, my guess would be that you need something like that: 如果我正确地理解了您的问题并参考了先前的问题,那么我猜您将需要这样的东西:
=IF(COUNTIF(Sheet2!$B:$B,$B3)>1,INDEX(Sheet2!E:E,MATCH($B3,Sheet2!$B:$B,0)),"")
Though now the risk of having a circular reference might be absent, so you could probably get away with: 尽管现在可能不存在拥有循环引用的风险,所以您可能可以避免:
=IFERROR(INDEX(Sheet2!E:E,MATCH($B3,Sheet2!$B:$B,0)),"")
If you want to add a sheet name, the syntax is Sheetname!Range
. 如果要添加工作表名称,则语法为
Sheetname!Range
。 If Sheetname
contains spaces, then you have to surround the name with single quotes, like 'Sheet name'!Range
. 如果
Sheetname
包含空格,则必须用单引号将名称引起来,例如'Sheet name'!Range
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.