You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Excel的IF内置函数中判断工作表是否受保护?

Solution to Replace Static TRUE/FALSE with Worksheet Protection Check

Alright, let's get this sorted! You want to swap out that fixed TRUE/FALSE in your IF function so it reacts to whether the worksheet is protected or not. Here's exactly how to do it:

Key Formula Breakdown

First, we use Excel's CELL function to check the worksheet's protection status. This function returns 1 if the sheet is protected, and 0 if it's not. We can pair this with your original IF logic to match your requirements:

  • When the sheet is unprotected (matches your Example 1's FALSE parameter), return "string"
  • When the sheet is protected (matches your Example 2's TRUE parameter), return NA()

Final Working Formula

=IF(CELL("protect", A1)=1, NA(), "string")

Note: Replace A1 with any cell from the current worksheet — it just needs a reference to the sheet you're checking.

Quick Tip for Auto-Refresh

The CELL function doesn't automatically recalculate unless there's a change in the worksheet. If you need the formula to update instantly when you toggle protection on/off, add a volatile function like NOW() to force recalculation:

=IF(CELL("protect", A1)&NOW()=1&NOW(), NA(), "string")

内容的提问来源于stack exchange,提问作者Sahil Shikalgar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 13:42:40