Excel: Checkbox, show value only if TRUE

Solved
Arisuann Posted messages 7 Status Membre -  
Arisuann Posted messages 7 Status Membre -
Hello everyone,

I need your help with Excel..

For example, I have 3 cells: my cell A1 displays 50, nothing in my cell B1 (this is where I'm stuck with my formula) and a checkbox in my cell C1.
I would like that if my cell C1 is "FALSE"; the value of B1 is zero (0 or nothing, it doesn't matter);
and if it is "TRUE"; the value of B1 displays the value of A1..

So far I have tried this formula and some variations but.... #ERROR!
=IF((C1=TRUE),A1,(C1=FALSE,0))

7 réponses

M-12 Posted messages 1349 Status Membre 285
 
1
Arisuann Posted messages 7 Status Membre 1
 
I FOUND IT! A THOUSAND THANKS brucine!

It's really simple, but not so easy to understand and connect everything!

I followed the links as you said, starting everything over

https://support.google.com/docs/answer/7684717?hl=fr&co=GENIE.Platform%3DDesktop

https://www.sheets-pratique.com/fr/astuces/case-a-cocher

And actually, I have to put a value in the data, but I set 1 for true and 0 for false while keeping the formula:
IF=(B2;25;0>
B2 being the checked box
25 the number to display if the box is checked
0 // if the box is unchecked

There you go, thank you so much!!
1
brucine Posted messages 24409 Registration date   Status Membre Last intervention   4 104
 
Hello,

If there is a checkbox in C1, it should be linked to cell C1 via right-click, format control, properties.

A conditional must always contain 3 parameters in the IF(x;y;z) format and as many opening parentheses as closing ones, and there is no need to test the FALSE condition since it is automatic if the TRUE condition is not met, in which case Excel executes the 3rd argument:

=IF(C1=TRUE;A1;0)
0
Arisuann Posted messages 7 Status Membre 1
 
Ah, I think I see, thank you for your two responses. Indeed, I found this formula... but I'm working on Excel on Google Drive, and I can't find this link on the right-click menu...
0
brucine Posted messages 24409 Registration date   Status Membre Last intervention   4 104
 
We're talking not about Excel but about Google Sheets?

https://support.google.com/docs/answer/7684717?hl=fr&co=GENIE.Platform%3DDesktop
0
Arisuann Posted messages 7 Status Membre 1
 
Yes, indeed! Excuse me.. I realize it's very different..
I am attaching the photos of what I did...
Knowing that in the example I gave:
A1=D102; B1=E102; C1=F102
I therefore inserted the formula:
=IF(F102=TRUE,D102,0)
but now it no longer shows ERROR but 0, whether I check my box or not..
(thank you so much for your help)
0
brucine Posted messages 24409 Registration date   Status Membre Last intervention   4 104
 
I don't understand anything about Google Sheets, but it seems to me that since the checkbox is TRUE/FALSE, the first argument of IF is necessarily TRUE, otherwise expressed:

=IF(F102,D102,0)
0
Arisuann Posted messages 7 Status Membre 1
 
Damn..
No, that's not working either..
(I'm attaching my error message..)
0
brucine Posted messages 24409 Registration date   Status Membre Last intervention   4 104
 
e pur si muove

One might want to customize the checkboxes by calling the checked box CHOCOLATE and the unchecked box VANILLA (text that would probably need to be placed in quotes but might get mixed up with the boolean value itself), as it is redundant to call them TRUE and FALSE since the mere fact of introducing a checkbox means it has a boolean value of TRUE if checked and FALSE otherwise.

https://www.sheets-pratique.com/fr/astuces/case-a-cocher
0
Arisuann Posted messages 7 Status Membre 1
 
My brain is getting all mixed up here..
I put the formula listed on the website..
0
brucine Posted messages 24409 Registration date   Status Membre Last intervention   4 104
 
We can't see anything in your screenshots, and they also won't enlarge.

I described VANILLE as any label that would describe the checkbox, which is optional.

It seems that the existence of any text is interpreted before the boolean value of the cell, obviously causing an error since a number (-55.42, but we can keep D2) is being called while the formula expects "VANILLE" in quotes (it's text).

I would start over and redefine the checkboxes exactly as described in the link: without any customization of the checkbox names.
1