{"id":7747,"date":"2017-06-04T03:48:04","date_gmt":"2017-06-04T03:48:04","guid":{"rendered":"http:\/\/www.nurturetechacademy.in\/?p=7747"},"modified":"2017-06-04T03:48:04","modified_gmt":"2017-06-04T03:48:04","slug":"apply-vlookup-duplicate-values","status":"publish","type":"post","link":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/apply-vlookup-duplicate-values\/","title":{"rendered":"How to apply Vlookup on duplicate values"},"content":{"rendered":"<p>Ever came across a situation where you need to apply Vlookup on duplicate lookup values?? Like the one below\u2026<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-7748 size-full\" src=\"http:\/\/www.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/1.png\" alt=\"1\" width=\"619\" height=\"268\" srcset=\"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/1.png 619w, https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/1-600x260.png 600w, https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/1-300x130.png 300w\" sizes=\"auto, (max-width: 619px) 100vw, 619px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Note:- Download the Exercise workbook from <a href=\"https:\/\/www.dropbox.com\/s\/f2n642emqxgm91a\/Vlookup%20on%20duplicate%20values.xlsx?dl=0\">here<\/a>.<\/p>\n<p>Here we have course ID repeating in \u201cLookup Table\u201d. If we simply apply Vlookup in result table, where course ID \u201cA1005\u201d is appearing multiple times, it will always come up with the first instance i.e.\u00a0 participant \u201cAakash\u201d. Now to get rid of this common problem, we have few solutions. In this post I will share one of the easiest ways to do this task.<\/p>\n<p>As you may have noticed, I intentionally kept column \u201cA\u201d blank. Here we will create unique values from column \u201cB\u201d, so that it would be easy to apply Vlookup.<\/p>\n<p><strong><em>Formula to create unique values:-<\/em><\/strong><\/p>\n<p>=COUNTIF($B$3:B3,B3)&amp;&#8221;-&#8220;&amp;B3<\/p>\n<p>Just type in the above formula in cell \u201cA3\u201d and copy and paste it till cell \u201cA9\u201d. This formula will count the number of times a course ID coming in the given range as this formula goes down. After that it will join the count with its course ID. This way we will get unique course IDs.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-7749 size-full\" src=\"http:\/\/www.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/2.png\" alt=\"2\" width=\"509\" height=\"314\" srcset=\"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/2.png 509w, https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/2-300x185.png 300w\" sizes=\"auto, (max-width: 509px) 100vw, 509px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>As you may notice, in cell \u201cA7\u201d the course ID \u201cA1005\u201d occurred second time since the beginning of the data, so it is taking this as \u201c2-A1005\u201d and in cell \u201cA9\u201d as \u201c3-A1005\u201d accordingly.<\/p>\n<p>Now in cell \u201cH3\u201d of \u201cResult Table\u201d we can enter the following vlookup formula with a slight change in lookup value. The reason we are not taking lookup value as cell \u201cG3\u201d simply because it has duplicate values, now as per our new field i.e. \u201cUnique Course ID\u201d in \u201cLookup table\u201d it could be \u201c1-A1005\u201d or \u201c2-A1005\u201d or may be \u201c3-A1005\u201d etc. but not just as \u201cA-1005\u201d.<\/p>\n<p>The formula will be:-<\/p>\n<p>=VLOOKUP(COUNTIF($G$3:G3,G3)&amp;&#8221;-&#8220;&amp;G3,$A$3:$D$9,4,FALSE)<\/p>\n<p>After putting the above formula in cell \u201cH3\u201d, just copy and paste it down.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-7750 size-full\" src=\"http:\/\/www.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/3.png\" alt=\"3\" width=\"756\" height=\"259\" srcset=\"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/3.png 756w, https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/3-600x206.png 600w, https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/uploads\/2017\/06\/3-300x103.png 300w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Note:- Download the Exercise workbook from <a href=\"https:\/\/www.dropbox.com\/s\/f2n642emqxgm91a\/Vlookup%20on%20duplicate%20values.xlsx?dl=0\">here<\/a>.<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_7747\" class=\"pvc_stats all  \" data-element-id=\"7747\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ever came across a situation where you need to apply Vlookup on duplicate lookup values?? Like the one below\u2026<br \/>\n&nbsp;<\/p>\n<p>&nbsp;<br \/>\nNote:- Download the Exercise workbook from here.<br \/>\nHere we have course ID repeating in \u201cLookup Table\u201d. If we <\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_7747\" class=\"pvc_stats all  \" data-element-id=\"7747\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":7751,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[56],"tags":[57,232],"class_list":["post-7747","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel","tag-excel","tag-vlookup"],"_links":{"self":[{"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/posts\/7747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/comments?post=7747"}],"version-history":[{"count":1,"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/posts\/7747\/revisions"}],"predecessor-version":[{"id":7752,"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/posts\/7747\/revisions\/7752"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/media\/7751"}],"wp:attachment":[{"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/media?parent=7747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/categories?post=7747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nurturetechacademy.in\/dev.nurturetechacademy.in\/wp-json\/wp\/v2\/tags?post=7747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}