在 Excel 中,先检查单元格是否为空,然后再填入表单答案。

huangapple go评论86阅读模式
英文:

Checking if CELL in excel is blank before populating with Form answer

问题

I am trying to write an expression that will check if a cell in a row in excel is blank, and if it is then insert an answer from a microsoft form, but if it isn't blank then just leave it as is.

我正在尝试编写一个表达式,以检查Excel行中的单元格是否为空,如果为空,则插入来自Microsoft表单的答案,但如果不为空,则保持不变。

英文:

I am trying to write an expression that will check if a cell in a row in excel is blank, and if it is then insert an answer from a microsoft form, but if it isn't blank then just leave it as is.

For a bit of background info, The flow I am writing does the following:

Takes a response from a microsoft form - which users fill out when they are changing job role - and then fills in the appropriate cells according to whats required for that job.

I have over 90 columns in my table and each job role (10 approx.) requires a different combination of each, so it was very time consuming to go in and insert the form response into each required column - see below.

在 Excel 中,先检查单元格是否为空,然后再填入表单答案。

So I am trying to write an expression that will check the contents of the cell to prevent overwriting already existing information.

I tried something like the following:

if(outputs('Get_a_row')?['body/HR PO 004'] = "","R"outputs('Get_response_details')?['body/r4cbf6e58f25742ff8104f08b6afe1b5e'],)

but it didn't work.

答案1

得分: 1

It’s all expression based in PowerAutomate, much like Excel, try this instead (untested) ...

如果你的情况类似于PowerAutomate和Excel,尝试使用以下代码(未经测试)...

if(equals(body('Get_a_row')['HR PO 004'], ''), body('Get_response_details')['r4cbf6e58f25742ff8104f08b6afe1b5e'], body('Get_a_row')['HR PO 004'])

... also, you've noticed I've changed out outputs for body.

...还要注意,我已将outputs更改为body

If it doesn't work 100%, you'll at least understand that you need to use the equals function to perform the comparison, not an operator like =.

如果不完全有效,至少你会明白需要使用equals函数进行比较,而不是像=这样的运算符。

英文:

It’s all expression based in PowerAutomate, much like Excel, try this instead (untested) ...

if(equals(body('Get_a_row')?['HR PO 004'], ''), body('Get_response_details')?['r4cbf6e58f25742ff8104f08b6afe1b5e'], body('Get_a_row')?['HR PO 004'])

... also, you've noticed I've changed out outputs for body.

If it doesn't work 100%, you'll at least understand that you need to use the equals function to perform the comparison, not an operator like =.

huangapple
  • 本文由 发表于 2023年5月11日 20:11:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76227531.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定