+ Reply to Thread
Results 1 to 11 of 11

Get last n row data from Columns in another sheet based on cell value using drop-down list

  1. #1
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    273

    Get last n row data from Columns in another sheet based on cell value using drop-down list

    Hello Seniors, and Talents,

    Attached is sample workbook, wherein;

    Sheet 2 is Input (RawData) from where I want to retrieve data in Sheet1 as follows:

    Sheet2 looks like -
    Student.jpg

    1) In Sheet1, Cell B11 currently I am using Data validation list (drop down list), from where I can select student name from range Sheet2!B2:K2. This could extend to column L or upto z or so (possibly sometime more than 200 students!), so flexibility is required.

    2) Based on Cell B11 cell value, where I select student name from Sheet2, I want to retrieve corresponding student name, LAST 6 TRANSACTIONS as shown in attached workbook, i.e. in range Sheet 1 ! C12:D17.
    StudentScore.jpg
    3) Please do note that in Sheet2, such dates, and marks will keep adding at bottom in rows, so I want to retrieve only last six record from bottom.

    4) Just to make it visually clear, I have manually shown last 6 row data corresponding to Student named Julie from Sheet2 in Sheet1! C12:D17

    5) Seek Help, how to avoid two appearance of same student name. If I put common name across two columns (deleting data from Sheet2 in cells C2, E2, G2 etc I get blank space under dropdown list in between two student name.

    What combination of OFFSET or MATCH/INDEX I should use to get above desired result. I tried several ways, but somewhere I am going wrong on concepts.

    How to keep formula flexible, such that, if student names expands in columns , and data gets added in rows, it gives the desired result.

    I don’t want VBA Macro code for above. Thanks.

    I keep switching between MS-Excel 1997-2003, so sometime using Combo Box made in higher version gets deleted, so am not using that but preferring data validation approach in cell to retrieve student name. So, please help, that it should work across possibly all version.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    273

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    There will not be duplicate student name in Sheet2 ColumnB2 onwards, no need to think on that line, Thanks

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,166

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    Cell C12:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Cell D12:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    both copied down.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    273

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    @TMS, thanks sir, It works well in current range of data, but fails, when

    1) i add new student in Column L, M in same pattern , Date and Score, and also, (this can be taken care of adjusting -
    Please Login or Register  to view this content.
    but then how to adjust automatically each time for new added row of data...that is..
    2) if i add, new row data in Sheet2 from Row12 onwards, it returns error, and does not retrieve, last 6 records counted from bottom.

    Possible to make use of Counta () function?
    Last edited by analystbank; 09-14-2017 at 06:46 AM.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,166

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    This:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    finds the last row, and this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    adjusts the row to be returned.

    I can't see any reason why that shouldn't return the last 6 rows regardless of how many rows you add.

    Please upload a sample workbook that demonstrates the problem.

  6. #6
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    273

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    thanks for your quick feedback, i missed to put data in Sheet2!ColumnA:A, and simply tested data with date and score.

    That answers all queries, with nice solution. Thank you, Sir. It works, and thanks for providing that insight to column A, which acts like handler...

    P.S.:Workbook is same as was posted in #1 above, and since spotted the mistake that i was doing, not posting it again.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,166

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    You're welcome.

  8. #8
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    273

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    You have answered well.

    Just one clarification, (i know this is against forum rules, to ask extra then original question), on one issue, which i could not envisage earlier, In the above (#1) sample book, in Sheet1 ! Column E, how to retrieve / get corresponding value from Sheet2!ColumnA:A, which only has value, HMark or LMark. We dont have to consider Column Label given in cell A2 as "Student" in Sheet2.

    something like

    StudentScore1.jpg
    This would only facilitate high or low mark tag, please if you can help here, and dont find it offending.

    Thanks
    Last edited by analystbank; 09-14-2017 at 08:32 AM.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,166

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    08-17-2013
    Location
    Asia
    MS-Off Ver
    Excel 2021
    Posts
    273

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    Thanks for all, Done, very nicely.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,166

    Re: Get last n row data from Columns in another sheet based on cell value using drop-down

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 09-15-2015, 02:32 AM
  2. Fetch the data from another sheet based on drop down list
    By sreejeshc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-25-2015, 02:26 AM
  3. Replies: 2
    Last Post: 03-03-2014, 03:31 PM
  4. Populate cell data based on data validation (drop down list)
    By ish_baho in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-05-2014, 11:47 PM
  5. Populate data in cell based on drop down list selection
    By dwoodson297 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-14-2013, 02:07 PM
  6. Returning a data list from one sheet to another based on a drop down menu
    By kk59204 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-16-2013, 01:21 PM
  7. Saving cell data based on drop down list
    By ewhaley50 in forum Excel General
    Replies: 1
    Last Post: 09-21-2011, 09:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1