excelif-statementexpressionpower-automatemicrosoft-forms

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.

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.

Update a row action

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.


Solution

  • 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 =.