• 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

Record IDs|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / Record IDs|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…Record IDs
sp_PrintTopic sp_TopicIcon
Record IDs
Avatar
Kevin Junk
Member
Members
Level 0
Forum Posts: 23
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
1
April 4, 2019 - 7:11 am
sp_Permalink sp_Print

Hi

I'm in a data migration exercise and have a s/sheet of over 100k rows and so I need a solution beyond a manual update.

For the sake of this post I'll simplify the problem: I have a s/sheet with three columns (A, B & C) (see attached), with headings [data type] as follows: Name [text], ID [number], CreateDate [date]. The data has been sorted on Col A to deliberately bring the duplicate values in focus in that column. The IDs are unique and the dates are not unique.

In the example there are five rows which can be 'grouped' into two groups by virtue of duplicated values in column A. So for rows 2 and 3 the value in Col A is abc, for rows 4, 5 & 6 the value in Col A is xyz.

The first task is to determine the latest CreateDate in each of the 'row-groups'. So in this example that would be 5/11/1999 for rows 2 and 3, and 3/12/2001 for rows 4 to 6. I do this by using the array formula {=MAX(IF(A2=$A:$A,$C:$C))} in column D. See the attached s/sheet.

The next task is proving difficult. Now that I have determined the latest date for each row-group, I want to put the ID that corresponds to that LatestDate in column E, so that the result would look like Column E in the attached s/sheet (colored red). But I need to do it with a formula/function, not manually. This is for a migration project so it doesn't have to be pretty.

Putting the matching ID in column E is easy (an IF statement) - see rows 3 & 6 - but I'm not pretending that's the solution. But I can't work out how to populate the other rows in each group with that same ID - in my attached example that would be rows 2, 4 & 5. After futile attempts with various formulae I am at a loss. My guess is that it needs to rely on column C (the matching values), and functions such as index and match ... or maybe VBA. Can anyone help me with this?

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
2
April 4, 2019 - 10:40 am
sp_Permalink sp_Print sp_EditHistory

Hi Kevin

You can try this formula. The assumption is that the latest ID for each group is the last transaction.

It doesn't look at the dates.

In cell F2 enter =LOOKUP(2,1/($A$2:$A$6=$A2),$B$2:$B$6)

Hope this helps.

Sunny

Avatar
Kevin Junk
Member
Members
Level 0
Forum Posts: 23
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
3
April 4, 2019 - 11:36 am
sp_Permalink sp_Print

Thanks for that.

We can't assume anything about the value of the ID and its relationship to Createdate, but I think your suggestion will work so long as the data is ordered by Name, then CreateDate, both descending.

Would you agree?

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
4
April 4, 2019 - 12:43 pm
sp_Permalink sp_Print

Hi Kevin

Agree!!

Try this if the dates are not in sequence:

=LOOKUP(2,1/(($A$2:$A$6=$A2)*($C$2:$C$6=$D2)),$B$2:$B$6)

Avatar
Kevin Junk
Member
Members
Level 0
Forum Posts: 23
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
5
April 5, 2019 - 6:46 am
sp_Permalink sp_Print

Thank you Sunny, I think this may have cracked it.

My only concern is the non-uniqueness of the dates may produce erroneous results but that will take some testing.

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
6
April 5, 2019 - 10:33 am
sp_Permalink sp_Print

Hi Kevin

Thanks for your feedback. I am only able to test based on your sample data.

If there are other scenarios, then do post them for us to take a look.

Cheers

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Richard Benson-King
Guest(s) 10
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:
wahab tunde
Cong Le Duc
Faisal Bashir
Ivica Cvetkovski
Blaine Cox
Shankar Srinivasan
riyepa fdgf
Hannah Cave
Len Matthews
Kristine Arthy
Forum Stats:
Groups: 3
Forums: 24
Topics: 6205
Posts: 27210

 

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