Reputation: 2079
I need help on my Excel sheet. How can I declare the following IF
condition properly?
if A1 = "n/a" then C1 = B1
else if A1 != "n/a" or has value(int) then C1 = A1*B1
Upvotes: 72
Views: 408007
Reputation: 1
You can also use IFERROR function. This function let's you return a desired value with the formula results in an #N/A error.
In your example try: =IFERROR(A1*B1,B1)
So if A1 is a value then it will calculate "A1*B1". If A1 is #N/A this calculation will error trying to multiply, so the formula will just result in "B1".
Upvotes: 0
Reputation: 11
use this formula to return the results for case of "FALSE"/"TRUE":
=IF(ISNA(A1)=TRUE, B1, A1*B1)
Upvotes: 1
Reputation: 46341
A possible alternative approach in Excel 2010 or later versions:
AGGREGATE(6,6,A1,B1)
In AGGREGATE
function the first 6
indicates PRODUCT
operation and the second 6
denotes "ignore errors"
[untested]
Upvotes: 0
Reputation: 14169
Input the following formula in C1
:
=IF(ISNA(A1),B1,A1*B1
)
Screenshots:
When #N/A:
When not #N/A:
Let us know if this helps.
Upvotes: 130
Reputation: 6720
"N/A" is not a string it is an error, try this:
=if(ISNA(A1),C1)
you have to place this fomula in cell B1 so it will get the value of your formula
Upvotes: 2