View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default Multiple "lookup_value"

"Jim Cone" wrote...
....
One, maybe obvious, comment is that in the case of duplicate entries the
SumProduct formula returns the sum of the duplicates (an incorrect
answer), while the Database function returns an error value.

....

You mean DGET? Having used (though sadly no more) Lotus 123 Release 3 and
later versions, I just can't take Excel's equivalents for 123 Release 2.x
@D... functions seriously, so I'd never suggest anyone else use them. Using
a criteria range instead of criteria expressions is just too fragile and
inflexible.

There's always a workaround if you want to check for existence and
uniqueness.

=CHOOSE(1+MIN(SUMPRODUCT((A2:A7="Apple")*(B2:B7="m ")*(C2:C7=2)),2),
#NULL!,SUMPRODUCT((A2:A7="Apple")*(B2:B7="m")*(C2: C7=2),D2:D7),#VALUE!)

Downside is that this reads through the criteria ranges twice.

However, I don't see this as a practical concern in spreadsheets. Unique
value lookups aren't even guaranteed in databases except when the lookup is
on key fields. Spreadsheet tables are even less likely to have key fields
than database tables, so I wouldn't expect even multiple field lookups to
produce just one or zero matches.