You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to detect if a cell is a pop-up menu?

I am trying to figure out how to have a cell detect if another cell is a pop-up menu, whether through a formula or conditional highlighting.


Essentially, I want to create a way for my spreadsheet to notify me if something accidentally gets deleted. If cells have a formula in them, this is easy: just have the cell detect if the other cell that's supposed to have a formula is blank (or get the formula text, and) if it's blank, show an error. But for a cell that has a pop-up menu (especially one that's set up to start with blank, how can I achieve this? It may be blank as far as there's no content displayed but the pop-up menu may still be there, so how I can I have my spreadsheet know if there is a cell is a pop-up menu or not? Am I thinking incorrectly here?

Posted on Jun 11, 2023 8:37 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 12, 2023 11:42 AM

Yellowbox, yet another Numbers community support LEGEND! Your idea got me thinking about a workaround, since I don't want some of my pop-up menus to start with the first item (I realized that for some of them, though, it makes sense for me to start with the first, so thank you for the suggestion). But for the others, I want them to start with blank, but allow the formulas or conditional highlighting to recognize them as NOT blank cells, since there is a pop-up menu occupying those cells. Perhaps there's a better way to think about this, in which case, I would love to hear suggestions on this.


For these pop-ups that I want to start with blank but not have them be recognized as blank cells, my workaround is as follows: create pop-up > format as "start with first item" > make "item 1" a space (just press spacebar) and press the enter/return key. The following will result in what LOOKS like a blank item with no text, but in actuality it contains 1 space value. So any formulas or conditional highlighting that detect if it is a blank cell will not detect it as a blank cell since there is, in fact, a value in the cell (the space value). If, however, that pop-up menu is deleted in the cell (by clearing/deleting the contents of the cell without removing the cell itself; in other words, by just pressing the "delete" key), the cell will still appear blank as before, but it will be truly blank now, since there is no space value from the pop-up menu anymore- there would be no pop-up at all anymore in this case. Thus, any aforementioned formulas or conditional highlighting WILL result in detecting it as blank.


Cells A1-A3 are a pop-up menu that starts with the first item. The first item in these pop-up menus are a space value.


Cell A4 is truly blank; there is nothing in the cell (not even a space value) and it is NOT a pop-up menu.


The formulas in Column B detect if the cell to the left is blank or not. B1 detects if A1 is blank, B2 detects if A2 is blank, etc. As you can see, with the pop-up formatted as I've described, it does not detect those cells (A1-A3) as blank. But for the cell that's truly blank (A4), the formula reflects that as being blank. This also works with conditional highlighting.


As you can see, if you try to filter Column A in this table, it shows one cell as truly blank "(Blank)" (referring to cell A4), one cell as "Item 2" (A2), one cell as "Item 3" (A3), and then one cell as nothing (or so it appears; I'm referring to the second option in the Filter menu with the checkmark but no text next to the checkmark. This is cell A1). If you removed cell A4, the first option "(Blank)" would be removed, and it would only show the bottom 3 options to filter from.


Here is the cell with the formatted pop-up menu, appearing blank.

Here is what it looks like when it's selected.


-


In contrast, here is a normal pop-up menu that's formatted to "start with blank".

Here is how the normal pop-up (start with blank) looks when selected. You can see how it differs from how my formatted pop-up menu looks when selected. The formula to the right also shows "TRUE" for this normal pop-up, meaning that it detects it as blank, despite there being a pop-up menu occupying that cell.


In conclusion: this is not a bad thing that Numbers is like this, and I know that this is perfectly normal for it to behave this way with pop-up menus starting with blank and those cells being recognized as blank. However, there will be some instances where one might want a cell to be recognized as NOT blank if there is a pop-up menu in that cell, and this is the best way I can find to achieve that natively (without using a script generously provided by SGIII above). Or maybe I'm just thinking too obtuse about this whole thing and all of this is unnecessary...?

Either way, here you go, internet!

5 replies
Question marked as Top-ranking reply

Jun 12, 2023 11:42 AM in response to Yellowbox

Yellowbox, yet another Numbers community support LEGEND! Your idea got me thinking about a workaround, since I don't want some of my pop-up menus to start with the first item (I realized that for some of them, though, it makes sense for me to start with the first, so thank you for the suggestion). But for the others, I want them to start with blank, but allow the formulas or conditional highlighting to recognize them as NOT blank cells, since there is a pop-up menu occupying those cells. Perhaps there's a better way to think about this, in which case, I would love to hear suggestions on this.


For these pop-ups that I want to start with blank but not have them be recognized as blank cells, my workaround is as follows: create pop-up > format as "start with first item" > make "item 1" a space (just press spacebar) and press the enter/return key. The following will result in what LOOKS like a blank item with no text, but in actuality it contains 1 space value. So any formulas or conditional highlighting that detect if it is a blank cell will not detect it as a blank cell since there is, in fact, a value in the cell (the space value). If, however, that pop-up menu is deleted in the cell (by clearing/deleting the contents of the cell without removing the cell itself; in other words, by just pressing the "delete" key), the cell will still appear blank as before, but it will be truly blank now, since there is no space value from the pop-up menu anymore- there would be no pop-up at all anymore in this case. Thus, any aforementioned formulas or conditional highlighting WILL result in detecting it as blank.


Cells A1-A3 are a pop-up menu that starts with the first item. The first item in these pop-up menus are a space value.


Cell A4 is truly blank; there is nothing in the cell (not even a space value) and it is NOT a pop-up menu.


The formulas in Column B detect if the cell to the left is blank or not. B1 detects if A1 is blank, B2 detects if A2 is blank, etc. As you can see, with the pop-up formatted as I've described, it does not detect those cells (A1-A3) as blank. But for the cell that's truly blank (A4), the formula reflects that as being blank. This also works with conditional highlighting.


As you can see, if you try to filter Column A in this table, it shows one cell as truly blank "(Blank)" (referring to cell A4), one cell as "Item 2" (A2), one cell as "Item 3" (A3), and then one cell as nothing (or so it appears; I'm referring to the second option in the Filter menu with the checkmark but no text next to the checkmark. This is cell A1). If you removed cell A4, the first option "(Blank)" would be removed, and it would only show the bottom 3 options to filter from.


Here is the cell with the formatted pop-up menu, appearing blank.

Here is what it looks like when it's selected.


-


In contrast, here is a normal pop-up menu that's formatted to "start with blank".

Here is how the normal pop-up (start with blank) looks when selected. You can see how it differs from how my formatted pop-up menu looks when selected. The formula to the right also shows "TRUE" for this normal pop-up, meaning that it detects it as blank, despite there being a pop-up menu occupying that cell.


In conclusion: this is not a bad thing that Numbers is like this, and I know that this is perfectly normal for it to behave this way with pop-up menus starting with blank and those cells being recognized as blank. However, there will be some instances where one might want a cell to be recognized as NOT blank if there is a pop-up menu in that cell, and this is the best way I can find to achieve that natively (without using a script generously provided by SGIII above). Or maybe I'm just thinking too obtuse about this whole thing and all of this is unnecessary...?

Either way, here you go, internet!

Jun 12, 2023 6:06 AM in response to PuddleOfFat

I don't think there is a way to detect the presence of a Pop-Up Menu in a cell via formula the way you can detect a formula with FORMULATEXT. Formulas treat a Pop-Up Menu with Start with Blank as any other blank cell when no other value in the menu is chose.


You can, however, detect the presence (or rather the lack thereof) of a Pop-Up Menu in a cell by using a simple AppleScript to check its format.


tell application "Numbers"
	tell active sheet of front document
		tell (first table whose class of selection range is range)
			repeat with c in cells of (get selection range)
				if format of c is not pop up menu then
					display dialog "Missing Pop-Up Menu in cell " & name of c
				end if
			end repeat
		end tell
	end tell
end tell



Just paste this into AppleScript Editor (in Applications > Utilities), select the range of cells that you expect all be Pop-Up Menu and run. It will notify you of the first selected cell that does not contain a Pop-Up Menu.



If you have to do this kind of check often the you can drag a Run AppleScript action into the Shortcuts app and paste the script in there and name and save the shortcut. With the Shortcut app you can pin a shortcut in the menu bar so that it becomes a menu choice.


SG


Jun 12, 2023 7:40 PM in response to PuddleOfFat

PuddleOfFat wrote:

For these pop-ups that I want to start with blank but not have them be recognized as blank cells, my workaround is as follows: create pop-up > format as "start with first item" > make "item 1" a space (just press spacebar) and press the enter/return key. The following will result in what LOOKS like a blank item with no text, but in actuality it contains 1 space value. So any formulas or conditional highlighting that detect if it is a blank cell will not detect it as a blank cell since there is, in fact, a value in the cell (the space value).

Brilliant use of a space to distinguish from a blank!

Regards,

Ian.

How to detect if a cell is a pop-up menu?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.