Confusing excel formulae DGET or Vlookup? Which one to use and when?
Picture Credit: https://in.pinterest.com/pin/342977327870951519/

Confusing excel formulae DGET or Vlookup? Which one to use and when?

DGET formula helps to extract the record based on the conditions specified. Now, it works similar to VLOOKUP formula but in some cases it is preferable. But before we dive in those cases, let us first see how DGET formula works.

DGET (database, field, criteria) whereas:

database is the range of cells from which you want to extract data based on the criteria specified

field represents the column header name or serial no. from which you want to extract data

criteria is the range of cells that contains the conditions specified. Please note, the cell range should include the header value and one cell below the header.

Let us understand this with an example:

Consider a dataset consisting of 3 columns viz. Sales, Month (1-12) and Code No. Based on the code no., we want to find the respective sales.

No alt text provided for this image

Now, if you have used Vlookup before, the first step would be to put column C before column A (i.e. Code No., Sales, Month - in that order) because Vlookup always work from Left to Right direction (i.e. the column from which you intend to find the value should be on RHS to the criteria column). But, DGET formula can work both ways.

Let us compare both the formulae here, so that you get a better understanding.

The agenda here is to find the respective sales for Code No.5

First we will use Vlookup to find the sales.

=vlookup(C3,A1:C10,1,False)

Notice that Vlookup returns #NA because Sales column is on LHS to the Code No. column. But for Vlookup to work properly, Sales column should be on RHS to Code No. Column.

No alt text provided for this image

But, when we rearrange the columns as shown here, Vlookup works properly.

=VLOOKUP(E3,E1:G10,2,false)

No alt text provided for this image

Now, Let us try to solve this using DGET formula (without rearranging the columns)

No alt text provided for this image

There's a small catch here, for DGET function to work properly, we need to put criteria column label and value in separate cells (in this case, C12:C13). Also, if you put the criteria cells in horizontal position (i.e. C12:D12), it won't work.

Now, using formula = dget(A1:C10,A1,C12:C13), we get the result in C17 cell.


Note that, there are some advantages as well as limitations to use DGET function.

Advantages:

  • It does not depend on the columns arrangement of dataset
  • It works well in case you have drop down values (Data Validation) in the criteria cell (C13 in the above example)

Limitation:

  • If there are duplication values in he criteria column (column C in our example), the function throws an error. Hence the criteria column should contain unique values


So, next time when you find such a case, you can use your best judgement on whether to use DGET or Vlookup.


Thanks! Keep Learning!

P.S. If you find this article useful, do like, comment & share!


Aakash Goel

Strategy & Product at Swiggy.

4 年

Very useful.. thanks for sharing ??

回复
Yash Karavat

Sr PM@SS&C | MBA | PMP? | CSM? | LSSBB | TAPMI | Project Management | Process Optimization

4 年

Insightful!

回复
Prithish Nandi

Technology Strategy Consultant @ Accenture Strategy | Ex-Deloitte India | MBA

4 年

Yes, it is very helpful. More so, now I needn't have to change the 'vlookup' formula syntax every time , i will simply create a separate table , apply this 'dget' formula and keep on changing the vales (in this case C12:C13 ) and get the output instantly (since it works both ways , can change A1 ->B1). Also, I found that it doesn't require the $ to be put in (some times i need to put it in 'vlookup'. Thanks

回复

要查看或添加评论,请登录

Aakash Chawla的更多文章

  • MS Excel- Dynamic Drop-down list

    MS Excel- Dynamic Drop-down list

    Have you ever wondered that while filling a registration form when we select State, in the next field all the cities or…

    3 条评论
  • Solver Analysis in Excel

    Solver Analysis in Excel

    In this article, we will solve the typical supply chain problem with the help of excel. Consider yourself in place of a…

    1 条评论
  • Dynamic Excel Graphs

    Dynamic Excel Graphs

    In this article, let us see how to create a dynamic clustered column graph where the maximum bar value is of different…

  • MS Excel Cell Modes

    MS Excel Cell Modes

    We all have used excel at some point in our life. Whether it is to perform a simple calculation or to do complex tasks.

    2 条评论

社区洞察

其他会员也浏览了