Assitance with if/then type excel formula/statement

squeakums

Well-known Member
Joined
May 15, 2007
Messages
823
Office Version
  1. 365
First, I want the formula to search column D, if column D is = "knott", then formula will make current cell "knott", otherwise use the formula below
=VLOOKUP(AJ2,'TPPE Mapping'!A:D,4,FALSE)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
One way:
Code:
=IF(COUNTIF(D:D,"knott")>0,"knott",[COLOR=#333333]VLOOKUP(AJ2,'TPPE Mapping'!A:D,4,FALSE))[/COLOR]
 
Upvote 0
It's almost right, although I don't want it looking in the entire column D:D, only D2, to see if "knott", if not use vlookup.
 
Upvote 0
It's almost right, although I don't want it looking in the entire column D:D, only D2, to see if "knott", if not use vlookup.
That's much easier:
Code:
=[COLOR=#ff0000]IF(D2="knott","knott"[/COLOR],[COLOR=#333333]VLOOKUP(AJ2,'TPPE Mapping'!A:D,4,FALSE))[/COLOR]
 
Upvote 0
Causes an #n/a error because it isn't going to the 2nd condition. Maybe an iferror statement?
 
Upvote 0
If you are getting a #N/A error, that means that:
- D2 is NOT equal to "knott"
AND
- it cannot find the value from cell AJ2 in column A of your 'TPPE Mapping' sheet.

So, none of your conditions are being met.
What do you want it to return when that happens?
 
Upvote 0
Nevermind, I figured it out, this formula works, thanks!
 
Last edited:
Upvote 0
Not true, because it is filling in knott if it finds knott, but it isn't doing the vlookup if knott isn't there
Ah, but it is!

I think you are not quite understanding how VLOOKUPs work. If it gets to the VLOOKUP part, and it cannot find the value you are trying to look up, it returns the #N/A error.
That is what appears is happening here.

What is the exact value you have in cell AP2?
It is telling you that it cannot find that value in column A of your 'TPPE Mapping' sheet.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,399
Members
448,957
Latest member
Hat4Life

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