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.

If statements in Numbers

So I am trying to create an IF statement for a pop-up menu on my money manager. I couldnt figure out how to get one of my selections to create a rule that if i select a certain option it will then make the value in another cell change a color depending on the selection chosen.

Ex. If I select the option "Auto Expense" in C2 then it will change the color of the text in E2 to the color red.


(also have the options containing emojis in the text but I am not sure if that will affect the statement at all)

MacBook Pro (2020 and later)

Posted on Jul 16, 2021 12:58 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 16, 2021 2:58 PM

Highlighting is based on the contents of the cell to be highlighted. To highlight cell E2, the rule must have something to do with the value in cell E2. The rule "if C2 is 'auto expense' then highlight cell E2" is not based on the value in cell E2 so it cannot be done. However, you can make a rule like "if cell E2 = cell F2 then highlight cell E2.


What you can do is insert a new column F that has the formula IF(C2="Auto Expense", E2, ""). The highlighting rule in cell E2 would be "if cell E2 is equal to cell F2 then red fill".



For the formula in column F, the usual one is the one given above

=IF(C2="Auto Expense", E2, "")

but I have been inclined recently to use the formula below instead because sometimes "" (null string) is an actual value and it will highlight red when you don't want it to

=IF(C2="Auto Expense", E2, CHAR(10000)).

the chosen character is highly unlikely to ever occur in a spreadsheet.


If you want multiple highlighting rules, you can get more clever. The formula below will get you three different possibilities:

=IFS(C2="Auto Expense", E2, C2= "House Expense",E2−1,C2="Food Expense",E2+1,TRUE,CHAR(10000))



If you want more than three rules, it is better to use multiple new columns, each with its own formula

=IF(C2="whatever", E2, CHAR(10000))

and the rules will refer to each of those columns.

"if E2 = F2 then red fill"

"if E2 = G2 then green fill"

"if E2 = H2 then yellow fill"

etc.


Probably more info than you wanted.


Similar questions

2 replies
Question marked as Top-ranking reply

Jul 16, 2021 2:58 PM in response to iiitstyler

Highlighting is based on the contents of the cell to be highlighted. To highlight cell E2, the rule must have something to do with the value in cell E2. The rule "if C2 is 'auto expense' then highlight cell E2" is not based on the value in cell E2 so it cannot be done. However, you can make a rule like "if cell E2 = cell F2 then highlight cell E2.


What you can do is insert a new column F that has the formula IF(C2="Auto Expense", E2, ""). The highlighting rule in cell E2 would be "if cell E2 is equal to cell F2 then red fill".



For the formula in column F, the usual one is the one given above

=IF(C2="Auto Expense", E2, "")

but I have been inclined recently to use the formula below instead because sometimes "" (null string) is an actual value and it will highlight red when you don't want it to

=IF(C2="Auto Expense", E2, CHAR(10000)).

the chosen character is highly unlikely to ever occur in a spreadsheet.


If you want multiple highlighting rules, you can get more clever. The formula below will get you three different possibilities:

=IFS(C2="Auto Expense", E2, C2= "House Expense",E2−1,C2="Food Expense",E2+1,TRUE,CHAR(10000))



If you want more than three rules, it is better to use multiple new columns, each with its own formula

=IF(C2="whatever", E2, CHAR(10000))

and the rules will refer to each of those columns.

"if E2 = F2 then red fill"

"if E2 = G2 then green fill"

"if E2 = H2 then yellow fill"

etc.


Probably more info than you wanted.


Jul 16, 2021 5:21 PM in response to Badunit

Here is the three-column approach:



F2 =IF($C2="auto expense",$E2,CHAR(10000))

G2 =IF($C2="house expense",$E2,CHAR(10000))

H2 =IF($C2="food expense",$E2,CHAR(10000))

fill down with all three to complete the columns (I only went partway down the table)


After you have it all set up and all the rules made, hide those three columns.

If statements in Numbers

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