+ Reply to Thread
Results 1 to 6 of 6

DGET with a hardcoded array for "criteria"

  1. #1
    Registered User
    Join Date
    03-30-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2010
    Posts
    12

    DGET with a hardcoded array for "criteria"

    I want to use the DGET function to populate a results table in an excel spreadsheet. Two of the "criteria" I'm using for the DGET function will be stored in the first row and first column of the output table. Unfortunately, it looks like DGET requires a contiguous array to be used as the "criteria" input. I have tried using an array constant (i.e. a hardcoded array using curly braces {}), but am getting errors. There seem to be two separate problems occurring:
    1. The DGET function returns an error when I try to use an array constant
    2. I don't think array constants can contain cell references; they literally have to be constants.

    Any input will be greatly appreciated. I've attached a spreadsheet showing an example of the problem.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: DGET with a hardcoded array for "criteria"

    Hello
    Personally I don't think the DGET function is suitable for hard coding variables as you're trying to do. Why not use Sumifs to achieve your results in the Goal table. See attachment.

    Hope this helps.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-30-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: DGET with a hardcoded array for "criteria"

    Hi DBY,
    Thanks for the response! I think you're right, sumifs is probably a much better way to go. I was attracted to the fact that dget automatically checks to make sure there is only a single entry that matches the criteria, which is good for error checking given that I will be working with many database tables. I guess I can always use a "countifs" as my error-checker to make sure there is only a single entry.

    I'd still be interested to know if anyone can get the database functions to work with a non-contiguous array, as I might like to use some of the other database functions (e.g. dproduct) in a similar way.

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: DGET with a hardcoded array for "criteria"

    You can use Formula as criteria. See the attached.
    Attached Files Attached Files
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  5. #5
    Registered User
    Join Date
    03-30-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: DGET with a hardcoded array for "criteria"

    Thank you Haseeb!

  6. #6
    Registered User
    Join Date
    05-07-2013
    Location
    México
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: DGET with a hardcoded array for "criteria"

    Thank you , I didn t know about sumifs

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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