Vlookup FOLLOWED by IF Statement?

njdevils3027

New Member
Joined
Jun 27, 2019
Messages
3
[FONT=&quot]Hi All,

[/FONT]
[FONT=&quot]I am trying to set up an Excel formula based off of a mapping table. I have a set of "level 1" codes in my data set and can match them to the mapping table that also includes these "level 1" codes via a Vlookup. That takes care of about 75/80% of the data set.

[/FONT]
[FONT=&quot]There are some lines of data that do not include this "level 1" code and I need to map it via a "level 2" code. However, this "level 2" code cannot be brought into the mapping table (for a separate reason).

[/FONT]
[FONT=&quot]My solution was to vlookup based on the "level 1" code and then follow that statement with a series of IF(cell="X","Y) statements to catch all of the "level 2" codes. This formula will be used for many different files in the future so it is best for me to catch all in one formula rather than hard code over any N/A's in this file.

[/FONT]
[FONT=&quot]I have no trouble BEGINNING the formula with the IF statements and ending it with the Vlookup. However, this overrides the Vlookup in the cases where the mapping does not align. I need a way for the Vlookup to be the FIRST function in the formula, with those IF's coming afterwards. Is that possible?

[/FONT]
[FONT=&quot]Something like:[/FONT]
[FONT=&quot]IFERROR(vlookup("level 1" cell,array from mapping table,count in mapping table, false), IF("level 2" cell="X","Y")

[/FONT]
[FONT=&quot]I have not been able to get that to work. Is there a better way around it?[/FONT]
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Welcome to Mr Excel forum

Maybe something like this
=IF(A2="level 1",VLOOKUP(A2,....),otherformula)

Adjust A2 to fit your actual case and replace otherformula with the formula that deals with level 2

Hope this helps

M.
 
Upvote 0
Thank you for the post, Marcelo. The issue is, there are about 310 "level 1" codes form this mapping table that I am using the vlookup for. I need the output for those to match what's in the mapping table. To have an IF statement for all of thos ewould be very cumbersome, right? Am I looking at this the wrong way?
 
Upvote 0
Is it possible to do an IFERROR with many arguments? So IFERROR beginning with the Vlookup, and then IF statements for the level 2 codes?
 
Upvote 0
Thank you for the post, Marcelo. The issue is, there are about 310 "level 1" codes form this mapping table that I am using the vlookup for. I need the output for those to match what's in the mapping table. To have an IF statement for all of thos ewould be very cumbersome, right? Am I looking at this the wrong way?

I'm not sure what you're trying to do
Could you provide a small data sample along with expected results

M.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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