循环浏览Google表格中的一组值 [英] Looping through a set of values in google sheets

查看:76
本文介绍了循环浏览Google表格中的一组值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2组数据.一种是坦克名称

I have 2 sets of data. One is tank names

Tank Name  
  A1
  A2
  B1
  B2

下一个是ON/OFF数据

and the next is ON/OFF Data

ON/OFF
  0
  0
  1
  1
  0
  1
  0
  1
  1
  0
  1
  0
  1

现在我正在寻找的结果是,当ON/OFF为1时,将提到第一个油箱:当其为0时,没有油箱被提及.一旦提到所有战车,那么它应该再次从第一个战车开始,即A1 ..

Now the result I am looking is, when the ON/OFF is 1 then the first tank is to be mentioned: when it's 0, no tank to be mentioned. Once all the tanks are mentioned,then it should again start from the first tank ie A1..like this

Result expected
 0  
 0  
 1  A1
 1  A2
 0  
 1  B1
 0  
 1  B2
 1  A1
 0  
 1  A2
 0  
 1  B1

您可以在此处查看Google工作表: https ://docs.google.com/spreadsheets/d/1SP2SfA-bzzhHgfrvpyUIkeQfUykata0oHxyD-x69yxE/edit?usp = sharing

You can check the google sheet here : https://docs.google.com/spreadsheets/d/1SP2SfA-bzzhHgfrvpyUIkeQfUykata0oHxyD-x69yxE/edit?usp=sharing

希望获得一些帮助以解决此问题. 谢谢

Hope to get some help to get this solved. Thanks

推荐答案

您可以使用在(例如)D2中输入并下拉的以下公式:

You can use this formula entered in (say) D2 and pulled down:

=if(B2=1,index(A$2:A,mod(sum(B$2:B2)-1,4)+1),"")

或者,如果愿意,可以改用E2中输入的数组公式:

or if you prefer, can go for an array formula entered in E2 instead:

=ArrayFormula(if(B2:B=1,vlookup(mod(sumif(row(B2:B),"<="&row(B2:B),B2:B)-1,4)+2,{row(2:5),A2:A5},2,false),""))

这篇关于循环浏览Google表格中的一组值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆