Google表格查询无法使用单元格引用

时间:2019-06-05 15:26:22

标签: google-sheets google-sheets-formula array-formulas google-sheets-query google-query-language

我使用查询功能从Google表格中的表格中提取数据。但是条件之一必须是对另一个单元格的引用。我是这样的:

=QUERY(Orig!A:Z;"select F where D= '"&C2&"' ";-1)

但是它没有发现任何巧合。但是,如果我将像这样的单元格C2的内容直接放在查询中,它将起作用:

=QUERY(Orig!A:Z;"select F where D=3400 ";-1)

我用于选择的D中的数据是数字,以及参考单元格C2中的数据。我尝试转换为文本,但没有任何效果!

1 个答案:

答案 0 :(得分:0)

当来源( C2 )是数字时,您的查询需要如下所示:

 #[[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[85,31951,9], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
     [[Node: rnn/transpose_1/_17 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_170_rnn/transpose_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antpc/Documents/Python/testpycharm/my_csv.py", line 198, in <module>


    tf.global_variables_initializer().run()
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2377, in run
    _run_using_default_session(self, feed_dict, self.graph, session)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 5215, in _run_using_default_session
    session.run(operation, feed_dict)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 900, in run
    run_metadata_ptr)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1135, in _run
    feed_dict_tensor, options, run_metadata)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1316, in _do_run
    run_metadata)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1335, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [85,31951,9]
     [[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[85,31951,9], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
     [[Node: rnn/transpose_1/_17 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_170_rnn/transpose_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

Caused by op 'Placeholder', defined at:
  File "/home/antpc/Documents/Python/testpycharm/my_csv.py", line 145, in <module>
    ##inputs = tf.placeholder(tf.float32, shape = (85,31951,9))  (85,31951,9)##
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/array_ops.py", line 1808, in placeholder
    return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 4848, in placeholder
    "Placeholder", dtype=dtype, shape=shape, name=name)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
    op_def=op_def)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

###InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [85,31951,9] ####
     [[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[85,31951,9], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
     [[Node: rnn/transpose_1/_17 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_170_rnn/transpose_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

否则,您需要这样做:

=QUERY(Orig!A:Z; "select F where D="&C2; -1)