+ Reply to Thread
Results 1 to 3 of 3

Searching Through Small Data Table

  1. #1
    Registered User
    Join Date
    02-06-2008
    Posts
    2

    Question Searching Through Small Data Table

    Hello,

    I'm not sure if this is exactly a programming question or if there's a combination of functions I'd need to use, but I think the question is straightforward and simple enough that I should be able to use Excel. I don't mind having to stir up access if need be, but I hope what I want to do is simple enough that I could just use some simple queries.

    Assume I have a set of data, say the characteristics of products:

    Please Login or Register  to view this content.
    And I then I want to populate the below table with id's from above, where the header on top (criteria 1) and the header on the left (criteria 2) are both exceded for the smallest price, and the inside of the below table is populated.

    Please Login or Register  to view this content.
    What I know:
    I could easily do this with an SQL statement like this:
    SELECT id FROM table WHERE criteria_1 > input1 AND criteria_2 > input2 ORDER BY price LIMIT 1
    However, there's no such thing as LIMIT (frustrating!), and I end up using things like TOP 1 instead... I feel like maybe I am doing poor practices.

    If I could set input1 and input2 to be a cell where I could drag and copy along, this would be no problem.

    However, I am finding myself using access and creating databases, creating parameterized variables, and that while you can set single query with a given parameter to take the parameter values out of cells, you can not just drag those cells and have them copy the relative cell stuff. If you want to have multiple parameter cells, it appears you need unique queries! YIKES if I have a 10 x 10 box to fill.

    I feel like I am making this WAY more complicated than I need to...

    I'm definitely a self-learner and I don't want to have someone write up the spreadsheet for me, I feel like maybe I'm making this way more complicated that I need to.

    Any help would be appreciated!

    thanks in advance,

    Matt

  2. #2
    Registered User
    Join Date
    02-06-2008
    Posts
    2

    Thumbs up Figured It Out

    Well, I figured since my data size isn't so large, i just went ahead and created some VBA scripts to look through my existing data.

    I just went through all 100 items for all combination sets and check with a series of IFs. I'm glad we're in 2007 and not 1999, or this would take forever... fortunately it takes just 3 seconds to run through the script.

    Anyway, thanks for reading. Solve bigger problems!

    Matt

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Matt, please don't delete your question if you answer it yourself. Just add what you did in case it helps someone else. You might add your code - it could help another user or maybe someone can offer a different method.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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