• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

VLookup query|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / VLookup query|General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…VLookup query
sp_PrintTopic sp_TopicIcon
VLookup query
Avatar
Dan Nelson

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
April 17, 2020
sp_UserOfflineSmall Offline
1
April 17, 2020 - 12:16 pm
sp_Permalink sp_Print

I have a table in the following format

vlookup.jpgImage Enlarger

I want to run a formula/query in column D to look in Column C and find the Item # in Column A matching it, and copy the text in column B of that Item #'s row into Column D of the searching row, otherwise leave it blank.  The result would be...

vlookup2.jpgImage Enlarger

I'm not constrained by which column the formula/query runs/executes in (it could be E or any other unused column), so long as the result ends up in Column D (in this example).

Why? I'm porting old DB3 data into a sql DB format for use in a php-based program using excel as the "middleware" (actually, I'm the middleware, excel is the tool). The actual table I'm working with is closer to 8000 rows, and, for example, row 5823 column C could well reference item # 2. 

This is just one small part of the porting transformation process, and actually, the last one I have to complete, before I test upload. Alas, my head exploded on this one.. 

(And if this works, I have a 90,000 row table to tackle next, thank God for "fill down"..)

Disclaimer: I'm retired, been quite a few years since I've used excel, and this is a non-profit exercise in every sense of the phrase.

sp_PlupAttachments Attachments
  • sp_PlupImage vlookup.jpg (30 KB)
  • sp_PlupImage vlookup2.jpg (32 KB)
sp_AnswersTopicSeeAnswer See Answer
Avatar
Dan Nelson

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
April 17, 2020
sp_UserOfflineSmall Offline
2
April 17, 2020 - 12:29 pm
sp_Permalink sp_Print

There were a couple of copy errors in the original vlookup2.jpg..

This is the corrected result

vlookup2-3.jpgImage Enlarger

 

(Now you know why I want to "script" this...)

sp_PlupAttachments Attachments
  • sp_PlupImage vlookup2-3.jpg (32 KB)
Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 871
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
3
April 18, 2020 - 1:59 am
sp_Permalink sp_Print sp_EditHistory

Hello,

As you have posted this in the Power Query section, do you want a PQ solution or do you want a standard Excel formula using VLOOKUP?

The Excel formula solution. Write in cell D2 and drag down.
=IFNA(VLOOKUP($C2,$A$2:$B$11,2,0),””)

I can’t give you the PQ solution now as I am using a tablet.

Br,
Anders

sp_AnswersTopicAnswer
Answers Post
Avatar
Dan Nelson

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
April 17, 2020
sp_UserOfflineSmall Offline
4
April 18, 2020 - 5:52 am
sp_Permalink sp_Print sp_EditHistory

Thanks for the reply, Anders!

Actually, at this point all I want is a solution that works.. whatever does the trick! (I didn't think a standard excel formula would work, but if your suggested solution does, I'm more than good with that..).

OK, I see what confused me with this originally... adding a dollar sign in front of the column alphabet (C in this example), it locks the column only. This means that if I drag the formula containing $C2, the column won't change, but the row will.

To make sure I understand the formula =IFNA(VLOOKUP($C2,$A$2:$B$11,2,0),””),  since the actual table I'm working with is far more extensive than this simple example, I believe the VLOOKUP part of the formula is saying:

lookup data "in column C of this row, for a match in the table A2 to B11 (column 1 of the defined table is default lookup), and copy column 2 data (of the matched row in the defined table). The "0" will force excel to return an N/A if there is nothing to match in Column C, correct?

If that is correct, then IFNA will return null "" if there is no match (i.e. column C has no lookup value, or there is no matching value in the specified range, and the vlookup result is "N/A").

Have I got that right?

-Dan

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4449
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
5
April 18, 2020 - 9:20 am
sp_Permalink sp_Print

Hi Dan,

Yes, you've correctly understood Anders solution.

Mynda

Avatar
Dan Nelson

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
April 17, 2020
sp_UserOfflineSmall Offline
6
April 18, 2020 - 11:44 pm
sp_Permalink sp_Print

Thanks Mynda, and thanks again Anders, and finally, thanks to the administrator for moving this to the proper topic! Off to put excel to work..

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Jeanine Hagge
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 205
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Othman AL MUTAIRI
Misael Gutierrez Sr.
Attif Ihsan
Kieran Fee
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Bhuwan Devkota
Kathryn Patton
Maria Conatser
Forum Stats:
Groups: 3
Forums: 24
Topics: 6222
Posts: 27293

 

Member Stats:
Guest Posters: 49
Members: 31916
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.