search
HomeComputer TutorialsComputer KnowledgeFind B20 in column A using VLOOKUP function in Table 2

VLOOKUPA2表2 A B 20

VLOOKUPA2 table 2 A B 2 0

If you don’t know how to generate buttons and associated programs, ask again. I won’t answer this part here.

Because your expression is ambiguous, here are three methods.

'1. Write a formula for the specified cell (slightly modify the specified cell or it can be a variable):

Sub writes formula () to cell

Range("B2").Select

ActiveCell.Formula = "=VLOOKUP(A2, Table 2!A:B,2,0)"

'ActiveCell.Formula = "=VLOOKUP(A:A, Table 2!A:B,2,0)"

'ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1], Table 2!C[-1]:C[0],2,0)"

'ActiveCell.FormulaR1C1 = "=VLOOKUP(C[-1], table 2!C[-1]:C[0],2,0)"

End Sub

'2. Explain the VLOOKUP function and find the value in the specified cell reference:

Sub Specify cell search reference()

Dim m

With Sheets("Table 2")

For m = 1 To .[A65536].End(3).Row

If .Cells(m, 1) = Sheets(1).Cells(2, 1) Then

Sheets(1).Cells(2, 2) = .Cells(m, 2)

End If

Next

End With

End Sub

'2. Explain the VLOOKUP function, which refers to the search value in the specified column. The above code is slightly optimized here and has universality:

Sub All Find References()

Dim i, j

With Sheets("Table 2")

For i = 1 To .[A65536].End(3).Row

For j = 1 To Sheets(1).[A65536].End(3).Row

If .Cells(i, 1) = Sheets(1).Cells(j, 1) Then

Sheets(1).Cells(j, 2) = .Cells(i, 2)

End If

Next

Next

End With

End Sub

How to call Excel functions in VBA instructions

Method/Step

Open Microsoft Office Excel 2007, click "Start" -> "Excel Options".

In the pop-up dialog box, select the "General" tab, and click "Show the 'Development Tools' tab in the ribbon" on the right, and click "OK".

Enter "radians" in cell A1, enter "angle" in cell B1, enter "3.14" in cell A2, then enter the formula "=DEGREES(A2)" in cell B2 and press Return After the car, the output result of this cell is 179.9087477.

Note: The DEGREES function is used to convert radians into angles.

Next, we use VBA to implement the same function. Click the "Development Tools" tab, click "Visual Basic" to start the Visual Basic Editor.

Right-click on "Microsoft Excel Object", click "Insert" -> "Module", create "Module 1", and enter the content in the module:

Sub Convert()

MsgBox Application.WorksheetFunction.Degrees(3.14)

End Sub

Click the "Run Subprocess/UserForm" button, select "Convert" in the pop-up dialog box, and then click the "Run" button.

The program pops up a dialog box, and the result is the same as the result output by the formula in Excel, except that the number of significant digits is different, which can be chosen as needed.

Summary: When doing VBA programming, you can use the WorkSheetFunction method to implement references to Excel functions. This can facilitate our reference to functions and avoid spending more time on custom functions, which effectively improves efficiency. Work efficiency.

The above is the detailed content of Find B20 in column A using VLOOKUP function in Table 2. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Excel办公网. If there is any infringement, please contact admin@php.cn delete
Download Hidester VPN/Proxy to Access Your Favorite Content - MiniToolDownload Hidester VPN/Proxy to Access Your Favorite Content - MiniToolApr 22, 2025 am 12:50 AM

Learn about Hidester VPN and Hidester proxy and download Hidester VPN for Windows, Mac, Android, and iOS to use this VPN service to view websites with no limit. For more useful free computer tools and troubleshooting tips, you may visit php.cn Softwa

Windows Keyboard Opening Shortcuts Instead of Typing [Fixed]Windows Keyboard Opening Shortcuts Instead of Typing [Fixed]Apr 22, 2025 am 12:48 AM

Have you ever encountered the trouble of “Windows keyboard opening shortcuts instead of typing”? In this post from php.cn, you will learn how to fix this issue.

Easy Ways to Add the Control Panel Icon to Desktop on Win 10 / 11Easy Ways to Add the Control Panel Icon to Desktop on Win 10 / 11Apr 22, 2025 am 12:46 AM

In this post, php.cn Software will introduce what Control Panel is and how to add the Control Panel icon to desktop on your Windows 10 or Windows 11 computer. You can also learn some related information about desktop icon settings.

Granblue Fantasy Relink Save File Location & Backup Save DataGranblue Fantasy Relink Save File Location & Backup Save DataApr 22, 2025 am 12:45 AM

If you play Granblue Fantasy: Relink on your PC, you may wonder where you can find its save file. In this post, php.cn introduces everything you want to know - Granblue Fantasy Relink save file location and how to back up the savegame of this game.

How to Fix Event ID 1104: The Security Log Is Now Full? - MiniToolHow to Fix Event ID 1104: The Security Log Is Now Full? - MiniToolApr 22, 2025 am 12:44 AM

Event Viewer keeps track of activity for better management. However, if the upper limit of the security log is reached, no more events can be logged. In this post on php.cn Website, we will show you how to deal with Event ID 1104 the security log is

Watch: How to Enable Secure Boot on Gigabyte Motherboard?Watch: How to Enable Secure Boot on Gigabyte Motherboard?Apr 22, 2025 am 12:43 AM

Secure Boot is a security standard that can prevent your computer from booting with untrustworthy software. Enabling it will add an extra layer of security to your device. In this post from php.cn Website, we will show you how to enable Secure Boot o

Windows 11 23H2 Release Date: September 26, 2023 - MiniToolWindows 11 23H2 Release Date: September 26, 2023 - MiniToolApr 22, 2025 am 12:42 AM

Coming to a new year, what Windows 11 users are looking forward to are not only the patch updates but also the annual major update for Windows 11. This post will talk about the Windows 11 23H2 release date. In addition, if you want to recover deleted

How to Turn off Bixby on Samsung Phone? See a Guide! - MiniToolHow to Turn off Bixby on Samsung Phone? See a Guide! - MiniToolApr 22, 2025 am 12:41 AM

Can you completely disable Bixby? How to turn off Bixby on Samsung phones? It is not hard to disable this voice assistant. In this post from php.cn, we will go to any length to help you find the method. Besides, a way to turn off “Hi, Bixby” is also

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools