And with If statement not working

topswim

Board Regular
Joined
May 14, 2002
Messages
133
Office Version
  1. 365
Platform
  1. Windows
Below I have a formula using the AND function with my IF statement (Y35), but notice it is not performing correctly. I should of returned A35 and not ??. Trying to understand why this is not functioning correctly. Hopefully this issue will resolve my vlookup issue where, for example=vlookup(w35,A:B,{1,2},false), is only bringing back A35 instead of A35 and B35.

Y35 A35 B35 C35 w35 X35 IF(AND(X35=0,W35="N"),A35,"??")
AZGIL06E03123AZGIL06E03N0??
 
If you look at the status bar, does it mention circular references
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
If so, this should help:

IF(AND(VALUE(X35)=0,W35="N"),A35,"??")
 
Upvote 0
If so, this should help:

IF(AND(VALUE(X35)=0,W35="N"),A35,"??")
Thank you. That did work Zyndstoff. I also noticed a difference in formatting of cells were different also. One is right aligned and the other left aligned for 0. Not sure why that is as it was just drag down from the cell above
0​
0
 
Upvote 0
Thank you. That did work Zyndstoff. I also noticed a difference in formatting of cells were different also. One is right aligned and the other left aligned for 0. Not sure why that is as it was just drag down from the cell above
0​
0
They are all formatted as General as I did check that too. I spoke too soon, this formula does not work when a value other then 0 is in the cell per below:
N803-756-480
#VALUE!​
 
Upvote 0
How about
Excel Formula:
=IFERROR(IF(AND(VALUE(X35)=0,W35="N"),A35,"??"),"??")
 
Upvote 0
Solution
They are all formatted as General as I did check that too. I spoke too soon, this formula does not work when a value other then 0 is in the cell per below:
N803-756-480
#VALUE!​

Well, you didn't ask for the formula to work for all numbers in the first place.
So your goal is to display the A-column value if X-column has any number in it?
 
Upvote 0
Try
IF(AND(VALUE(LEFT(X35,1)>=0),W35="N"),A35,"??")

This should work whenever the first letter of X35 can be interpreted as a number as well aswhemever x35 is a number in the first place.

BTW: 803-756-480 is no value, it is a text. Texts will be aligned left, values will be aligned right in Excels "General" cells.
 
Last edited:
Upvote 0
Okay, so I got a little glitch in the above formula. This should fix it:

=IF(ISERROR(AND(VALUE(LEFT(X35,1))>-1,W35="N")),"??",A35)
 
Upvote 0
My oh my... I got it wrong again. Now this is my final shot - tested. :)

=IF(AND(ISERROR(VALUE(LEFT(X35,1)))=FALSE,W35="N"),A35,"??")
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top