ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   elegant programmed solution to local minima with constraints (https://www.excelbanter.com/excel-programming/335822-elegant-programmed-solution-local-minima-constraints.html)

Bill[_32_]

elegant programmed solution to local minima with constraints
 
I have several columns of data that I create from a database query, I
analyze it, and then publish to a web page and then I can refresh the
output analysis report from the htm.

One of the things I need to do is find a minimal date value subject to
constraints such that the first column is equal to a variable search
value and the second column is equal to a fixed text string value. The
data in the first and second columns can have duplicate entries.

example

c55, hello, monday
c55, goodbye, tuesday
c55, hello, wednesday
c46, hello, monday
c46, goodbye, tuesday
c46, goodbye, friday

etc.

I'm looking for the earliest date a first column entry said goodbye,
for example. So my first local min is c55, goodbye, first on tuesday.
The second local min is c46 said goodbye first on tuesday, etc.

The database is active so each refresh would requery and bring back new
entries and data.

I can see a few ways to do this with brute force by either doing some
sorting and filtering and maybe lookup functions inside excel.

I think I could also just brute force my way through a macro vba
program and just loop through the list to find the local min for each
entry criteria constraint. But this would be a slow search.

What I'm hoping for is something more elegant that would run fairly
fast in a table of around 20,000 row entries. Something in VBA so that
I can refresh from the html and have a new report published without
going back into excel each time.

I'm willing to do the programming work I'm just looking for some tips
to head me down the right path.

Thanks
Bill



All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com