Assuming you want the common number to appear in another cell, you can do this relatively simply in a macro function.Select the area in column A. Hold down the control key and select the area in column B. This produces a selection range with two areas. In the target cell, invoke the macro.
The macro simply loops through the first area. For each cell, it loops through the second area. If it finds a match, that is the common value. If not, it repeats this loop for the next cell in the first area. If no match is found at all, it returns an error value of your choice, such as #NA.