• 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
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

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
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: 5
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
Level 1
Forum Posts: 614
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: 880
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: 880
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: 5
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: 880
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: 5
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: Lakisha Hall, Lorna Henning
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
Hans Hallebeek: 185
Newest Members:
Appiagyei Kofi Frimpong
Hilary Burchfield
Richie Wright
Adel Kock
Barbara Murray
Doug Milne
Siobhan Stringer
Rob Rooth
Tom Lewis
Jennifer Rodriguez-Avila
Forum Stats:
Groups: 3
Forums: 24
Topics: 6542
Posts: 28641

 

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

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • 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

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

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

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.