Change Excel Drop-down selection based on status o

2019-09-21 04:57发布

I have an Excel doc that has a named list in the "G" column, consisting of numbers 1-4 and 9999 that indicate project priority (they also have conditional code on them that changes the color of the row based on selection.

In column "H" I have a progress counter that lets the user enter one of 4 percentages 25/50/75/100.

does anyone know how to make it so that if column H is set to 100, it would change the status of the "G" column to "9999" (the fifth selection on the DD list.)?

1条回答
Lonely孤独者°
2楼-- · 2019-09-21 05:19

Easiest way is to just prefill column G with a formula. E.g. in G2:

=IF(H2=100,9999,"")

You can still apply the drop down validation on top of a cell with a formula. The formula will be overwritten with whatever value is chosen from the drop down menu.

If you need to be able to specify a value in the G column and then still have it automatically change to 9999 later, you'll either need to use a 3rd column that always holds a formula referencing both columns G and H:

=IF(H2=100,9999,G2)

Or you'll need to write VBA that runs on the Worksheet_Change event. It the Target is in column H and has a value of 9999, then it will update the value of the cell in column G and the same row as the Target.

查看更多
登录 后发表回答