简体   繁体   English

如何在谷歌表中结合 Arrayconstrain 和 Vlookup 公式?

[英]How to combine Arrayconstrain and Vlookup formula in google sheet?

I created a slip format in google sheet and I would also print it afterwards.我在谷歌表中创建了一个单据格式,之后我也会打印它。 These slips are numbered from 1 to infinity.这些单据编号从 1 到无穷大。

I need help in constructing the formula.我需要帮助来构建公式。

What i created so far: https://docs.google.com/spreadsheets/d/1MU_kBQgfyqgFuVet3hU6DW_WLuYwYYJ51uU-cB38gsQ/edit?usp=sharing到目前为止我创建的内容: https : //docs.google.com/spreadsheets/d/1MU_kBQgfyqgFuVet3hU6DW_WLuYwYYJ51uU-cB38gsQ/edit?usp=sharing

What i wanted to happen: when i type the number in cell S1, it would also reflect the corresponding QWS No. in cell T2.我想要发生的事情:当我在单元格 S1 中键入数字时,它也会在单元格 T2 中反映相应的 QWS 编号。

To do this, I was thinking that I should incorporate Vlookup (as what i placed in cell S2) inside the Arrayconstrain formula in column T. However, i don't know if it is possible though.为此,我想我应该在 T 列的 Arrayconstrain 公式中加入 Vlookup(如我在单元格 S2 中放置的内容)。但是,我不知道这是否可行。

Thank you!谢谢!

Answer:回答:

Rather than using VLOOKUP , you can do this by running a QUERY instead.您可以通过运行QUERY代替使用VLOOKUP来完成此操作。

Forumla:论坛:

=ARRAY_CONSTRAIN(QUERY('QWS Tracker'!A3:B, "select B where (A="&S1&") or (A="&S1+1&") or (A="&S1+2&")"),3,1)

Rundown of this Formula:这个公式的纲要:

  • Query the sheet 'QWS Tracker'!A3:B for:查询表'QWS Tracker'!A3:B以获取:
    • Values of column B where: B 列的值,其中:
      • The corresponding cell in row A is either S1 , S1 + 1 or S1 + 2 A 行中对应的单元格是S1S1 + 1S1 + 2
  • Contstrain the Array to length 3将数组限制为长度 3

I hope this is helpful to you!我希望这对你有帮助!

References:参考:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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