
- MS Excel Basics
- Excel - Home
- Excel - Getting Started
- Excel - Explore Window
- Excel - Backstage
- Excel - Entering Values
- Excel - Move Around
- Excel - Save Workbook
- Excel - Create Worksheet
- Excel - Copy Worksheet
- Excel - Hiding Worksheet
- Excel - Delete Worksheet
- Excel - Close Workbook
- Excel - Open Workbook
- Excel - Context Help
- Editing Worksheet
- Excel - Insert Data
- Excel - Select Data
- Excel - Delete Data
- Excel - Move Data
- Excel - Rows & Columns
- Excel - Copy & Paste
- Excel - Find & Replace
- Excel - Spell Check
- Excel - Zoom In-Out
- Excel - Special Symbols
- Excel - Insert Comments
- Excel - Add Text Box
- Excel - Undo Changes
- Formatting Cells
- Excel - Setting Cell Type
- Excel - Setting Fonts
- Excel - Text Decoration
- Excel - Rotate Cells
- Excel - Setting Colors
- Excel - Text Alignments
- Excel - Merge & Wrap
- Excel - Borders and Shades
- Excel - Apply Formatting
- Formatting Worksheets
- Excel - Sheet Options
- Excel - Adjust Margins
- Excel - Page Orientation
- Excel - Header and Footer
- Excel - Insert Page Breaks
- Excel - Set Background
- Excel - Freeze Panes
- Excel - Conditional Format
- Working with Formula
- Excel - Creating Formulas
- Excel - Copying Formulas
- Excel - Formula Reference
- Excel - Using Functions
- Excel - Builtin Functions
- Advanced Operations
- Excel - Data Filtering
- Excel - Data Sorting
- Excel - Using Ranges
- Excel - Data Validation
- Excel - Using Styles
- Excel - Using Themes
- Excel - Using Templates
- Excel - Using Macros
- Excel - Adding Graphics
- Excel - Cross Referencing
- Excel - Printing Worksheets
- Excel - Email Workbooks
- Excel- Translate Worksheet
- Excel - Workbook Security
- Excel - Data Tables
- Excel - Pivot Tables
- Excel - Simple Charts
- Excel - Pivot Charts
- Excel - Keyboard Shortcuts
- MS Excel Resources
- Excel - Quick Guide
- Excel - Useful Resources
- Excel - Discussion
How to get the cell value based on row and column numbers in Excel?
In the article user will understand the process of generating a cell value by utilizing the row and column numbers in excel. The main purpose of the article is to describe two simple ways to solve the provided task. In the first example, an already defined formula is used, that is by utilizing the INDIRECT value, user can generate the required result. On the other hand, the second example is generating the same cell value by using the VBA code. After writing the VBA code, the user needs to generate a function call from a provided method.
Example 1: To get the cell value based on row and column numbers in excel by using the user defined formula:
Step 1:
This worksheet contains three columns. First column with data values for “Name of product”, second column contains data for “Age of product”, and third column contains “sample number”. After that in the H3 cell create header for row with value 3 stored in the I3 cell. similarly, go to cell H4, to create a column header, with value 5 stored in the I4 cell. finally, create H5 cell with header “RESULT”. The resultant value will be stored to the cell I5. Consider below provided snapshot for proper reference:

Step 2:
Go to the I5, cell and type or paste the formula “=INDIRECT(ADDRESS(I3,I4))”. Consider proper snapshot provided below for detailed reference −

Explanation for above formula:
The ADDRESS function takes two arguments: the row number and the column number of a cell, and returns a text string that represents the address of that cell in A1-style notation. In this case, the row number is given by the value in cell I3, and the column number is given by the value in cell I4. For example, if I3 contains the value 5 and I4 contains the value 7, then the result of the ADDRESS function would be the text string "G5".
The INDIRECT function takes a text string argument that represents a reference to a cell or range of cells in Excel, and returns the value of that cell or range. In this case, the text string that represents the cell reference is obtained from the ADDRESS function as described above. So if the result of the ADDRESS function is "G5", then the INDIRECT function will return the value of the cell at column G and row 5.
In summary, the formula INDIRECT(ADDRESS(I3,I4)) returns the value of the cell that is specified by the row and column numbers in cells I3 and I4, respectively. This can be useful in situations where you want to refer to a cell using dynamic row and column numbers that are determined by other cells in the worksheet.
Step 3:
After typing the formula, press “Enter” key, to obtain the required output result.

The final obtained result contains sample number for 3rd row, and 5th column, that is the generated result is SMP1.
Example 2: To get the cell value based on row and column numbers in excel by using the VBA code:
Step 1:
This worksheet contains three columns. First column with data values for “Name of product”, second column contains data for “Age of product”, and third column contains “sample number”. Consider below provided snapshot for proper reference−

Step 2:
To open the code editor for VBA, go to the “Developer” tab, and choose option for “Visual Basic”, under the code section. Consider below provide snapshot −

Step 3:
The above step will open a “Microsoft Visual Basic for Applications” dialog box.

Step 4:
Go to the menu bar and click on “Insert”. After that click on “Module”. Consider below provided snapshot for reference−

Step 5:
The above step will open a blank code area, as depicted below −

Step 6:
Copy the below-given code to the code window.
' function header Function get_val(r As Integer, c As Integer) ' retrieving data from a provided location get_val = ActiveSheet.Cells(r, c) ' end of the function header End Function
Use proper code indentation to avoid coding errors. The code snapshot is depicted below, use it for complete and precise code writing.

Step 5:
After declaring the function module, press “Alt + Q” key combination to exit the current dialog box. In the excel sheet, write the formula “=get_val(I3,I4)” to generate the possible results. Here, get_val is the name of function, and I3 and I4 are the cell reference for the excel sheet.

Step 6:
The generated result value is SMP1. Consider below provide image for proper reference −

Conclusion
This article contains explanations for two examples. Both examples will perform the same task and can generate the same sample number based on the provided row and column values. The only difference between them is the approach. The first example calculates data by using the formula, while the second example calculates the result based on the provided VBA code, and can work only when the defined function is called with proper parameter values.
- Related Articles
- How to Copy a Column Based on Cell Value to Another Excel Sheet?
- How to change value based on cell color in Excel?
- How to Auto-Strikethrough Based on Cell Value in Excel?
- How to get row or column letter of the current cell in Excel?
- How to Auto-Number a Column Based on the Cell Values on Another Column in Excel?
- How to Automatically Send Email Based on Cell Value in Excel?
- How to get row index based on a value of an R data frame column?
- How to Auto Change the Shape and Size Based on a Specified Cell Value in Excel?
- How to Auto-Highlight the Row and Column of an Active Cell in Excel?
- How to get row index or column index based on their names in R?
- How to border cells based on cell values in Excel?
- How to AutoFilter Rows Based on Cell Values in Excel?
- How to Always Get the Value from the Above Cell when Inserting or Deleting a Row in Excel?
- Deleting a DataFrame row in Python Pandas based on column value
- How to Auto-Insert Rows Based on Cell Values in Excel?
- How to Alternate Row Colour Based on Group in Excel?\n
