|
-
Oct 25th, 2019, 02:15 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Datatable select rows after value and before value (multiple headers in rows)
I'm pulling an Excel file into a Datatable and the data ends up like:
Column A | Column B
_______________________________________
Retirement Plan: A |
Employee | Employee deduction
Ralph | $100
Sue | $100
Bob | $0
Retirement Plan: B |
Employee | Employee deduction
Ralph | $0
Sue | $150
Bob | $0
_____________________________
So, I need to add Sue's deduction into the proper Retirement plan in the database.
I have another datatable with all employees name in it so I can loop through it and compare to the names in this datatable to get the deduction, however since there are multiple column headers in the rows (Retirement Plans) I don't know how to figure out which Retirement plan is above Sue's name when I find it in the For Each loop.
Since I know the Retirement plan names (A, B) I could just do a LINQ Select to find the retirement plan row and then a Do until I find a blank row between the retirement plans? Seems sloppy?
Anyone know a slick way to separate this out when the headers end up like this?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|