# VLOOKUP issue

#### rck

##### New Member
Excel 2000
ABCDEF
1RD_NOOLD_DISTRICTNEW_DISTRICT
2LVA3006=VLOOKUP(A2,\$E\$2:\$F\$129,2,FALSE)=B2LVB1004
3LVA3016=VLOOKUP(A3,\$E\$2:\$F\$129,2,FALSE)LVB1014
4LVB1005=VLOOKUP(A4,\$E\$2:\$F\$129,2,FALSE)LVB2024
5LVB1015=VLOOKUP(A5,\$E\$2:\$F\$129,2,FALSE)LVB2034
6LVB2006=VLOOKUP(A6,\$E\$2:\$F\$129,2,FALSE)LVB2044
7LVB2016=VLOOKUP(A7,\$E\$2:\$F\$129,2,FALSE)LVB2054

</tbody>
All RDs
<b>Excel 2000</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">RD_NO</td><td style="text-align: center;;">OLD_DISTRICT</td><td style="text-align: center;;">NEW_DISTRICT</td><td style="text-align: right;;"></td><td style=";"></td><td style=";"></td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">LVA300</td><td style="text-align: center;;">6</td><td style="text-align: center;;">#N/A</td><td style="text-align: right;;"></td><td style=";">LVB100</td><td style=";">4</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">LVA301</td><td style="text-align: center;;">6</td><td style="text-align: center;;">#N/A</td><td style="text-align: right;;"></td><td style=";">LVB101</td><td style=";">4</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">LVB100</td><td style="text-align: center;;">5</td><td style="text-align: center;;">4</td><td style="text-align: right;;"></td><td style=";">LVB202</td><td style=";">4</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">LVB101</td><td style="text-align: center;;">5</td><td style="text-align: center;;">4</td><td style="text-align: right;;"></td><td style=";">LVB203</td><td style=";">4</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">LVB200</td><td style="text-align: center;;">6</td><td style="text-align: center;;">#N/A</td><td style="text-align: right;;"></td><td style=";">LVB204</td><td style=";">4</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style=";">LVB201</td><td style="text-align: center;;">6</td><td style="text-align: center;;">#N/A</td><td style="text-align: right;;"></td><td style=";">LVB205</td><td style=";">4</td></tr></tbody></table><p style="width:4.2em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">All RDs</p><br /><br />

I would like to keep the value in B2 if it does not change based of the VLOOKUP formula. IF A2 does not match E2, then keep the existing value in B2. If it does match, then change the value in B2 to the value in F2.

The VLOOKUP formula in C3 works for changing the value, but inserts #N/A if it doesn't find a match.

Last edited:

#### jamtay317

##### Well-known Member
Code:
``=<code>if(isna(vlookup(</code>[COLOR=#333333][FONT=Verdana][/FONT][/COLOR][CENTER][COLOR=#333333][FONT=Verdana]A2,\$E\$2:\$F\$129,2,FALSE)),b2,[/FONT][/COLOR][COLOR=#333333][FONT=Verdana]A2,\$E\$2:\$F\$129,2,FALSE))[/FONT][/COLOR][/CENTER]``
try this <code>

</code>

#### Andrew Poulsom

##### MrExcel MVP
Maybe try:

=IF(COUNTIF(\$E\$2:\$E\$129,A2),IF(VLOOKUP(A2,\$E\$2:\$F\$129,2,FALSE)=B2,B2,VLOOKUP(A2,\$E\$2:\$F\$129,2,FALSE)),B2)

rck

#### jamtay317

##### Well-known Member
=<code>if(isna(</code>VLOOKUP(A2,\$E\$2:\$F\$129,2,FALSE)),b2,VLOOKUP(A2,\$E\$2:\$F\$129,2,FALSE))

#### Rick Rothstein

##### MrExcel MVP
Does this formula do what you want?

=IFERROR(INDEX(F\$2:F\$129,MATCH(A2,E\$2:E\$129,0)),B2)

#### rck

##### New Member
That was it, Andrew! Thank you so much!

Maybe try:

=IF(COUNTIF(\$E\$2:\$E\$129,A2),IF(VLOOKUP(A2,\$E\$2:\$F\$129,2,FALSE)=B2,B2,VLOOKUP(A2,\$E\$2:\$F\$129,2,FALSE)),B2)

#### markmzz

##### MrExcel MVP
Maybe this:

Code:
``=IF(ISERROR(1/(VLOOKUP(A2,\$E\$2:\$F\$129,2,0)<>B2)),B2,VLOOKUP(A2,\$E\$2:\$F\$129,2,0))``
Markmzz

#### Rick Rothstein

##### MrExcel MVP
Does this formula do what you want?

=IFERROR(INDEX(F\$2:F\$129,MATCH(A2,E\$2:E\$129,0)),B2)
I just realized your are using XL2000. I do not have that version available, so I cannot test these, but I think one of these should should work for you. Try this one first...

=IF(COUNTIF(E\$2:E\$129,A2),INDEX(F\$2:F\$129,MATCH(A2,E\$2:E\$129,0)),B2)

and if it doesn't work, then try this one...

=IF(ISERROR(MATCH(A2,E\$2:E\$129,0)),B2,INDEX(F\$2:F\$129,MATCH(A2,E\$2:E\$129,0)))

#### markmzz

##### MrExcel MVP
A small modification in the formula:

Code:
``=IF(ISERROR(VLOOKUP(A2,\$E\$2:\$F\$129,2,0)),B2,VLOOKUP(A2,\$E\$2:\$F\$129,2,0))``
Markmzz

1,081,546
Messages
5,359,455
Members
400,529
Latest member
Ratish52

### This Week's Hot Topics

• VBA (Userform)
Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
• List box that changes fill color
Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
• Remove duplicates and retain one. Cross-linked cases
Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
• VBA Copy and Paste With Duplicates
Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
• Macro
is it possible for a macro to run if the active cell value is different to the value above it
• IF DATE and TIME
I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...