Reputation: 198
Excel 2019
I've been using Excel for years but I cannot figure out why I'm getting this error. It's the smallest little formula but the lovely and completely generic error isn't telling me what's wrong.
So I have a spreadsheet with a column (G) that is filled with TRUE or FALSE values. All I want to do is, in the next column (H), put a zero if it's G cell is FALSE and a 1 if it's TRUE. If I put in the H cell a formula that says =G2 it works and replicates the value. If I put =G2 = FALSE (for a FALSE value) then it correctly puts TRUE in the cell. However if I put the following statement in the cell I get the generic error "There is a problem with this formula": =IF(G2 = FALSE, 0,1)
It looks right to me but I can't figure it out. Why does the logical test work alone but not in an IF statement? I tried changing around the data types for the G and H columns with no love. I know it's stupid and I know I'm missing something but I just can't seem to get it working. If anyone can rent me a clue that would be lovely.
Thank you!
Upvotes: 1
Views: 1008
Reputation: 198
Had some great help on and I'm going to say that Scott Craner's answer is the one I used. It seems that double dash exists specifically to change TRUE and FALSE values to numbers. All of the following worked quite well. Thank you folks!
=--G2 (Scott Craner)
=INT(G2) (JvdV)
=G2*1 (Jim)
Upvotes: 1
Reputation: 11
In Excel TRUE & FALSE already have values attached to them, so as strange as it may seem just times it by one "=G2*1",that should give you what you are looking for.
Upvotes: 1