Excel Formula If Statement - multiple criteria

jwoo89

New Member
Joined
Jan 5, 2021
Messages
32
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I have been trying to figure out the correct formula to use but I am getting stuck. Hopefully someone can help!

I have four columns A-D. In column A I need to pull in the correct sector from column B but Some cells i am not able to pull data in so the following words below show up. Basically if the below three texts show up in that cell, i need to move over to column C but that also appears to have the same issue and from there will need to move to column D and pull the sector from there.
#N/A Invalid Security
#N/A Field Not Applicable
#N/A N/A

So far I have the formula

=IF(M5="#N/A N/A",N5,IF(M5="#N/A Field Not Applicable",N5,IF(M5="N/A Invalid Security",N5,IF(N5="#N/A N/A",O5,IF(N5="#N/A Field Not Applicable",O5,IF(N5="N/A Invalid Security",O5,M5))))))

But when i get to the ones that are invalid and have either of those three words appear the If statement doesn't work.

Can somebody help?

1626894117010.png



Thanks for your help!!!
 
If that is the case then this works fine for me

Excel Formula:
=IF(NOT(OR(B2="#N/A N/A",B2="#N/A Field Not Applicable",B2="N/A Invalid Security")),B2,IF(NOT(OR(C2="#N/A N/A",C2="#N/A Field Not Applicable",C2="N/A Invalid Security")),C2,IF(NOT(OR(D2="#N/A N/A",D2="#N/A Field Not Applicable",D2="N/A Invalid Security")),D2,"Not in M, N or O")))
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
If that is the case then this works fine for me

Excel Formula:
=IF(NOT(OR(B2="#N/A N/A",B2="#N/A Field Not Applicable",B2="N/A Invalid Security")),B2,IF(NOT(OR(C2="#N/A N/A",C2="#N/A Field Not Applicable",C2="N/A Invalid Security")),C2,IF(NOT(OR(D2="#N/A N/A",D2="#N/A Field Not Applicable",D2="N/A Invalid Security")),D2,"Not in M, N or O")))
So it works well! but when the columns b and c have an error its not pulling in what is in column D for some reason
 
Upvote 0
Did you try the formula I suggested?
 
Upvote 0
It should work, I have included another option in col B
+Fluff 1.xlsm
ABCDE
1
2ElectronicsElectronics#N/A n/a#N/A Field Not ApplicableElectronics
3ElectronicsTechnologyTechnology#N/A Field Not ApplicableElectronics
4TechnologyTechnology#N/A Field Not ApplicableTechnology
List
Cell Formulas
RangeFormula
A2:A4A2=LOOKUP(2,1/((LEFT(C2:E2,4)<>"#N/A")*(C2:E2<>"")),C2:E2)
B2:B4B2=INDEX(C2:E2,AGGREGATE(15,6,(COLUMN(C2:E2)-COLUMN(C2)+1)/(LEFT(C2:E2,4)<>"#N/A"),1))
 
Upvote 0
So it works well! but when the columns b and c have an error its not pulling in what is in column D for some reason

here it works perfect
Book5
ABCD
1ABCD
22#N/A Field Not Applicable#N/A Field Not Applicable2
Sheet1
Cell Formulas
RangeFormula
A2A2=IF(NOT(OR(B2="#N/A N/A",B2="#N/A Field Not Applicable",B2="N/A Invalid Security")),B2,IF(NOT(OR(C2="#N/A N/A",C2="#N/A Field Not Applicable",C2="N/A Invalid Security")),C2,IF(NOT(OR(D2="#N/A N/A",D2="#N/A Field Not Applicable",D2="N/A Invalid Security")),D2,"Not in M, N or O")))
 
Upvote 0
All works fine except A3

Book6
ABCDEF
1FluffFluffAli
2ElectronicsElectronicsElectronics#N/A n/a#N/A Field Not ApplicableElectronics
3ElectronicsTechnologyTechnologyTechnology#N/A Field Not ApplicableElectronics
4TechnologyTechnologyTechnology#N/A Field Not ApplicableTechnology
Sheet1
Cell Formulas
RangeFormula
A2:A4A2=LOOKUP(2,1/((LEFT(D2:F2,4)<>"#N/A")*(D2:F2<>"")),D2:F2)
B2:B4B2=INDEX(D2:F2,AGGREGATE(15,6,(COLUMN(D2:F2)-COLUMN(D2)+1)/(LEFT(D2:F2,4)<>"#N/A"),1))
C2:C4C2=IF(NOT(OR(D2="#N/A N/A",D2="#N/A Field Not Applicable",D2="N/A Invalid Security")),D2,IF(NOT(OR(E2="#N/A N/A",E2="#N/A Field Not Applicable",E2="N/A Invalid Security")),E2,IF(NOT(OR(F2="#N/A N/A",F2="#N/A Field Not Applicable",F2="N/A Invalid Security")),F2,"Not in Any of three")))
 
Upvote 0
here it works perfect
Book5
ABCD
1ABCD
22#N/A Field Not Applicable#N/A Field Not Applicable2
Sheet1
Cell Formulas
RangeFormula
A2A2=IF(NOT(OR(B2="#N/A N/A",B2="#N/A Field Not Applicable",B2="N/A Invalid Security")),B2,IF(NOT(OR(C2="#N/A N/A",C2="#N/A Field Not Applicable",C2="N/A Invalid Security")),C2,IF(NOT(OR(D2="#N/A N/A",D2="#N/A Field Not Applicable",D2="N/A Invalid Security")),D2,"Not in M, N or O")))
AHHH THIS IS AMAZING!!! thank you so much! it worked!!!
 
Upvote 0
It should work, I have included another option in col B
+Fluff 1.xlsm
ABCDE
1
2ElectronicsElectronics#N/A n/a#N/A Field Not ApplicableElectronics
3ElectronicsTechnologyTechnology#N/A Field Not ApplicableElectronics
4TechnologyTechnology#N/A Field Not ApplicableTechnology
List
Cell Formulas
RangeFormula
A2:A4A2=LOOKUP(2,1/((LEFT(C2:E2,4)<>"#N/A")*(C2:E2<>"")),C2:E2)
B2:B4B2=INDEX(C2:E2,AGGREGATE(15,6,(COLUMN(C2:E2)-COLUMN(C2)+1)/(LEFT(C2:E2,4)<>"#N/A"),1))
This also worked!! thank you both so much fluff and A durfani!!! you guys are awesome :)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,638
Members
449,093
Latest member
Ahmad123098

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