I need to retrieve information from multiple rows in a table based on certain criteria (date compared to today's date, existence of "no" in a column).
Problem and solution I would like attached. Many thanks.
I need to retrieve information from multiple rows in a table based on certain criteria (date compared to today's date, existence of "no" in a column).
Problem and solution I would like attached. Many thanks.
Last edited by carbonn; 11-11-2009 at 06:18 PM. Reason: solved
Your sheet indicates you want this to be going on "automatically", so I would think a macro would be the way to go. Is VBA ok?
Here are two versions of a macro that will do what you want based on moving that data back up to A1 as the starting point, like normal.
This macro goes into the sheet module itself, so just by bringing the sheet up onscreen, the Overdue report updates itself.Please Login or Register to view this content.
How to install the sheet macro:
1. Open up your workbook
2. Right-click on the OVERDUE sheet tab and select View Code
3. Copy and Paste in your code (given above)
4. Get out of VBA (Press Alt+Q)
6. Save your sheet
The macro is installed and ready to use. Simply move to another sheet, then return to the OVERDUE sheet and it will update.
==========
This version is a standalone macro that goes in a regular module and can be run from the macro menus. How to install the macro:Please Login or Register to view this content.
1. Open up your workbook
2. Get into VB Editor (Press Alt+F11)
3. Insert a new module (Insert > Module)
4. Copy and Paste in your code (given above)
5. Get out of VBA (Press Alt+Q)
6. Save your sheet
The macro is installed and ready to use. Press Alt-F8 and select it from the macro list.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
VBA is fantastic, do you think that this could be done with some combination of index/vlookup/match? I am not up to speed with these yet.
Yes it can. In fact I'm glad you asked. I didn't look at your "desired results" section very carefully, did I? Sorry about that...the index/match technique is actually well suited to this task.
I added a "key column" to the data sheet so that it can flag the overdue items in an easy sequential way. You can hide that column if you find it unsightly.
On the OverDue page, we then index/match those key rows into the table and do the required math on the last column.
Last edited by JBeaucaire; 11-11-2009 at 01:13 PM.
It's a thing of beauty - will take me a few minutes (!) to work out why it works, but it does, and much quicker than the VBA - especially as my sparklines macro seemed to really slow it down - presumably it was running every time something changed on the page as well.
Many thanks.
You didn't mention you had other sheet-level macros active on that sheet. Yes, the macros would interfere with each other unless you specifically tell the active macro to suppress others.
To do that, you add these lines of code to the top and bottom of the macro:
Using that, your macros will always trigger independently and execute quickly.Please Login or Register to view this content.
Yes, I didn't know either (not my macros). I've been removed from macros long enough to be dangerous but to completely forget about how the nuances work.
Thanks for the advice.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks