Reputation: 134
If A2=10,B2=2 means A2 higher than B2 result will get result "Good", but how if A2 is symbol "-" ?
How can I change "-" to "0" inside this Google Spreadsheet formula?
=IF(AND(A2>=B2), "Good")
I find this formula but no idea how to combine with above formula
=SUBSTITUTE(A2,"-","0")
Here my spreadsheet https://docs.google.com/spreadsheets/d/1sIpOA2bgh_00nNW70pMy4FBruRzdhOtRXFQrAb-PJTc/edit?usp=sharing
Thank you for anyone who willing help me
Upvotes: 0
Views: 492
Reputation: 5023
Swap out the A2 in the first formula with --SUBSTITUTE(A2,"-",0)
, ie
=IF(AND(--SUBSTITUTE(A2,"-",0)>=B2), "Good")
The -- converts the SUBSTITUTE
result to a number. We need this or it will be a string after SUBSTITUTE
, and the comparison won't work like you expect. Note that this will convert any number of -
s to 0, not just a single one.
I kept the AND
because I assume you want to add more to it later.
Upvotes: 2