简体   繁体   中英

Returning a value based on Multiple Drop-Down Cells

I've taken over a file, and want to have a "Current Status" cell auto-populate based on select drop-down cell choices. So if all the dropdowns are "N/A", I want to return a status of "N/A". If all are "Complete", return status "Complete". And then also mix: If some are "Complete" and some "In Progress", return "In Progress".

  • If all are blank, returns blank
  • All are Not-Started, returns Not-Started (ER1 in formula below)
  • All are Complete, returns Complete (ER3 in formula below)
  • All are N/A, returns N/A (ER4 in formula below)
  • If any are marked In Progress/Complete/NA, returns In Progress (ER2 in formula below)

Our Current formula is this:

=IF(AND(ISBLANK(DV4),ISBLANK(DW4),ISBLANK(DX4),ISBLANK(DY4),ISBLANK(DZ4),ISBLANK(EA4),ISBLANK(EB4),ISBLANK(EC4),ISBLANK(ED4),ISBLANK(EE4),ISBLANK(EF4),ISBLANK(EG4),ISBLANK(EH4),ISBLANK(EI4),ISBLANK(EJ4),ISBLANK(EK4),ISBLANK(EL4),ISBLANK(EM4),ISBLANK(EN4),ISBLANK(EO4))," ",IF(AND(DV4=$ER$3,DW4=$ER$3,DX4=$ER$3,DY4=$ER$3,DZ4=$ER$3,EA4=$ER$3,EB4=$ER$3,EC4=$ER$3,ED4=$ER$3,EE4=$ER$3,EF4=$ER$3,EG4=$ER$3,EH4=$ER$3,EI4=$ER$3,EJ4=$ER$3,EK4=$ER$3,EL4=$ER$3,EM4=$ER$3,EN4=$ER$3,EO4=$ER$3),"COMPLETE",IF(AND(DV4=$ER$4,DW4=$ER$4,DX4=$ER$4,DY4=$ER$4,DZ4=$ER$4,EA4=$ER$4,EB4=$ER$4,EC4=$ER$4,ED4=$ER$4,EE4=$ER$4,EF4=$ER$4,EG4=$ER$4,EH4=$ER$4,EI4=$ER$4,EJ4=$ER$4,EK4=$ER$4,EL4=$ER$4,EM4=$ER$4,EN4=$ER$4,EO4=$ER$4),"N/A",(IF(OR(DV4=$ER$2,DW4=$ER$2,DX4=$ER$2,DY4=$ER$2,DZ4=$ER$2,EA4=$ER$2,EB4=$ER$2,EC4=$ER$2,ED4=$ER$2,EE4=$ER$2,EF4=$ER$2,EG4=$ER$2,EH4=$ER$2,EI4=$ER$2,EJ4=$ER$2,EK4=$ER$2,EL4=$ER$2,EM4=$ER$2,EN4=$ER$2,EO4=$ER$2,DV4=$ER$3,DW4=$ER$3,DX4=$ER$3,DY4=$ER$3,DZ4=$ER$3,EA4=$ER$3,EB4=$ER$3,EC4=$ER$3,ED4=$ER$3,EE4=$ER$3,EF4=$ER$3,EG4=$ER$3,EH4=$ER$3,EI4=$ER$3,EJ4=$ER$3,EK4=$ER$3,EL4=$ER$3,EM4=$ER$3,EN4=$ER$3,EO4=$ER$3),"IN PROGRESS",IF(OR(DV4=$ER$1,DW4=$ER$1,DX4=$ER$1,DY4=$ER$1,DZ4=$ER$1,EA4=$ER$1,EB4=$ER$1,EC4=$ER$1,ED4=$ER$1,EE4=$ER$1,EF4=$ER$1,EG4=$ER$1,EH4=$ER$1,EI4=$ER$1,EJ4=$ER$1,EK4=$ER$1,EL4=$ER$1,EM4=$ER$1,EN4=$ER$1,EO4=$ER$1),"NOT STARTED","IN PROGRESS"))))))

Which is working, but I want to make it cleaner and easier to change in the future. Rather than having to select each individual cell and make If/OR/AND statements for each one. I've tried using MATCH, but that seems to only count if 1 of the cells in the array is correct, rather than if they all Match. I thought maybe I could use EXACT and then a True/False with it, but Exact only seems to check 2 specific cells rather than a line. My googling led me to array formulas, but try as I might I couldn't get them to work. I thought it would work maybe to just use IF(A1:A9,) and complete the formula, but it doesn't seem to like that either.

Thank you

Edit: Example Table在此处输入图片说明

I believe this will satisfy:

=IF(COUNTA(B2:F2)=0,"",IF(COUNTIF(B2:F2,B2)=COLUMNS(B2:F2),B2,"In Progress"))

在此处输入图片说明

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