• 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

One to Many VLookup/Power Query|Power Query|Excel Forum|My Online Training Hub

You are here: Home / One to Many VLookup/Power Query|Power Query|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 ForumPower QueryOne to Many VLookup/Power Query
sp_PrintTopic sp_TopicIcon
One to Many VLookup/Power Query
Avatar
David Barfoot

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
July 22, 2022
sp_UserOfflineSmall Offline
1
July 23, 2022 - 12:45 am
sp_Permalink sp_Print

I have one sheet with a long list of unique account numbers (account key). I have another sheet where each account key has multiple rows with data set out in different columns (the F, H and S Terms).

I am looking to do a lookup to consolidate the data so each Key has just one line and I can list the F, H and S on the same line. Formulas for the yellow cells on the Keys tab basically.

I am looking to do this in Power Query ideally but would be good to know how to do in Excel also.

Many thanks 

Avatar
Riny van Eekelen
Örnsköldsvik, Sweden
Moderator
Members


Trusted Members

Moderators

Power BI
Level 0
Forum Posts: 440
Member Since:
January 31, 2022
sp_UserOfflineSmall Offline
2
July 23, 2022 - 2:27 am
sp_Permalink sp_Print sp_EditHistory

Hi David,

Looked at your file but it's not clear what you want to achieve. The file includes two queries, presumably to each of the data ranges in the two sheets. But how would the end result have to look like?

R

Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 870
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
3
July 23, 2022 - 10:07 am
sp_Permalink sp_Print sp_EditHistory

Hello,

If you rearrange your data as shown in Data (2) sheet you can easily get what you want with a Pivot Table.
I have not created such Pivot Table for you, but do give a shout out if you want help with creating one.

Br,
Anders

Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 870
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
4
July 24, 2022 - 4:43 am
sp_Permalink sp_Print

Hello again,

In attached file you now have such Pivot Table and I have used Power Query to rearrange the data structure to correct one.

Br,
Anders

Avatar
David Barfoot

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
July 22, 2022
sp_UserOfflineSmall Offline
5
July 29, 2022 - 1:15 am
sp_Permalink sp_Print

Hi Anders,

Thanks for your response, that doesn't work the values for the terms are in text format i.e. 30 Days End of Month, 52 End of Month etc if I unpivot and try and summarize in a pivot table the values are useless. That example was just to try and illustrate my problem, my actual spreadsheet is rather large and has a load of other columns in as well as the terms. 

If I put the account key into a single list with no duplicates and try to merge it with the master table I want to look up into whenever it see's a duplicate value it adds another row when this is not what I want. I want a single list (no duplicates) of all the account keys and to basically returns the first non blank value for the designated columns i.e. the F,H,S terms (there is more that I will need but just put those so someone could hopefully show me how this is done)

Thanks

Dave

Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 870
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
6
July 29, 2022 - 4:00 am
sp_Permalink sp_Print

Hello,

Ok, even if the values are text you can use Power Pivot with the help of a measure to show the text data as values. See attached file for such example.

Br,
Anders

Avatar
David Barfoot

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
July 22, 2022
sp_UserOfflineSmall Offline
7
August 18, 2022 - 11:54 pm
sp_Permalink sp_Print

If I do that it duplicates the terms where there is more than one term for that type, I wish to basically do a vlookup and return the first non blank value for a designated column. Can this not be done in Power Query, I have the below formula which returns the first match (whether this is blank or not), can this not be adjusted somehow to return the first non blank match?

= try SupplierAccountsImport{Table.PositionOf(SupplierAccountsImport[[Account Key]],[Account Key=[UniqueKey]])}[Haulier Terms] otherwise null

Thanks

Dave

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Shanna Henseler
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
John Chisholm
vexokeb sdfg
John Jack
Malcolm Toy
Ray-Yu Yang
George Shihadeh
Naomi Rumble
Uwe von Gostomski
Jonathan Jones
drsven
Forum Stats:
Groups: 3
Forums: 24
Topics: 6212
Posts: 27237

 

Member Stats:
Guest Posters: 49
Members: 31889
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.