简体   繁体   中英

Change Google spreadsheet cell contents based on the contents of other cells

In a 'new' Google spreadsheet, I want to monitor the contents of particular cells to have a "status" cell automatically show the progress of an order.

Can anyone help me with a script that would automatically alter the contents of cell K8:K, depending upon the contents of cells L8:L, R8:R, Y8:Y, AA8:AA and AB8:AB?

Please forgive the syntax, I've never learned a script language... The logic would go something like this:

If L<>0 then K="Awaiting order"
If R<>0 or Q<>0 then K="In progress"
If AA<>0 and Y=0 then K="Sent for invoicing (docs incomplete)"
If AA<>0 and Y<>0 then K="Sent for invoicing (docs complete)"
If AB<>0 and Y<>0 then K="Closed (complete)"

I'm using "<>0" to indicate that something has been entered into the cell and "=0" to indicate that the cell is empty. If multiple arguments were true, then the later one in the sequence should take precedence.

Back when I knew how to program, you could use lots of IF/ELSE statements to achieve the desired priorities, but I really have no clue where to start these days, except Google, which, when looking for info about how to achieve complex Google Spreadsheet tasks, usually leads me to Stack Overflow!

Any help will be gratefully received!

It sounds like you want to use a combination of nested if functions and the isBlank function in the formulae in column K.

So to model just the first part of what you're trying to do, the formula in K8 might be something like:

if( not(isBlank(L8)), "Awaiting Order", if( not(isBlank(R8)), "In Progress", "Other conditions go here" ) )

You indicated in the comments you want to do an or function as well. The syntax for just that part might be

or( isBlank(Q9), isBlank(R9) )

公认的是公式而不是脚本,但请尝试使用K8并复制下来以适合:

=if(and(AB8<>"",Y8<>""),"Closed (complete)",if(and(AA8<>"",Y8=""),"Sent for invoicing (docs complete)",if(and(AA8<>"",Y8<>""),"Sent for invoicing (docs incomplete)",if(R8<>"","In progress",if(L8<>"","Awaiting order","")))))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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