How to create a lookup function or VBA code which can return value against only first found result?

user3200076

Suppose, in Sheet1, I have an Order table

OrderNo.  ShipmentNo.  Rate
54321          AP2312
54321          AP2312
29781          AP2312
32181          AP2312
54321          AP2312

In sheet2, I have rate table

OrderNo.     Rate
S4321          65

the below table is the end result which I am trying to get by applying some kind of lookup based on sheet2 rate table

OrderNo.  ShipmentNo.  Rate
54321     AP2312       65
54321     AP2312       0
29781     AP2312       NA
32181     AP2312       NA
54321     AP2312       0

which means, the formula should return the value against only first found result viz. 54321 in this case.

Subodh Tiwari sktneer

You may try this

On Sheet1 In C2

=IFERROR(IF(COUNTIF(A$2:A2,A2)=1,VLOOKUP(A2,Sheet2!A:B,2,0),0),"NA")

Edit: Or more correctly this

=IF(ISNUMBER(MATCH(A2,Sheet2!A:A,0)),IF(COUNTIF(A$2:A2,A2)=1,VLOOKUP(A2,Sheet2!A:B,2,0),0),"NA")

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to return first non-blank value with LOOKUP function

Single test recursion - how to create the "no result found" return value?

How to create function which return only even numbers in array?

How i can Replace Only first Result in SQL Function

How to return more values to the calling function in Python3 and display the result, currently it's printing only first value without increment?

How can I return text value of an array instead the function result?

How to return only first match result in XPath?

How to create a value which can be repeatedly used throughout XSLT code?

Function return only first output value by default

Array Function Only Return First Value

How to make a function which normally returns a value, return undefined rather than null when the value cannot be found

How to return a result from a VBA function

How to Create Function in Code First?

How to return the value of the first header found above a paragraph in word using vba?

How to return a value from a function if no value is found

Return only first found value from for-each

How to create function which return array of widgets

R : How to create objects with a function which name and value depend on an argument, and that these objects are found in the global environment?

Lookup excel return min value if no match found

Lookup which list a name is in and return the top value

How to sort an array based document and return only the first element of the result

How to create a function which eliminates repeated code

How to elegantly create a function which returns a lambda's return value or nothing?

how to create generic function which will return value of any level of pointer in c++?

How to create an Excel file which contain only the result using Pandas?

How can I create a function which will take a date and return schedules based on time condition

how can a call to a function return a string only the first time and undefined thereafter

Lookup value with in range and return to first row cell

How to get only the return value of a function in c?

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive