Excel & VBA Cheat Sheet – Don’t Miss This !

Excel & VBA Cheat Sheet - Commands & Syntax List !

Excel and VBA are powerful tools for data analysis, reporting, and automation. Whether you’re a beginner or an experienced user, having a cheat sheet handy can greatly enhance your productivity. In this comprehensive Excel and VBA cheat sheet, we’ve compiled essential formulas, functions, and shortcuts to help you work more efficiently and effectively in Excel. Don’t miss this valuable resource that can simplify your workflow and make you a more proficient Excel user.

DescriptionVBA Code
Activate by Tab NameSheets(“Input”).Activate
Activate by VBA Code NameSheet1.Activate
Activate by Index Position
Sheets(1).Activate
Next SheetActiveSheet.Next.Activate
Get ActiveSheetMsgBox ActiveSheet.Name
Select SheetSheets(“Input”).Select
Set to VariableDim ws as Worksheet
Set ws = ActiveSheet
Name / RenameActiveSheet.Name = “NewName”
Add SheetSheets.Add
Add Sheet and NameSheets.Add.Name = “NewSheet”
Add Sheet to VariableDim ws As Worksheet
Set ws = Sheets.Add
Copy SheetSheets(“Sheet1”).Copy Before:=Sheets(“Sheet2”)
Unhide SheetSheets(“Sheet1”).Visible = True
or
Sheets(“Sheet1”).Visible = xlSheetVisible
Hide SheetSheets(“Sheet1”).visible = False
or
Sheets(“Sheet1”).visible = xlSheetHidden
Very Hide SheetSheets(“Sheet1”).Visible = xlSheetVeryHidden
Delete SheetSheets(“Sheet1”).Delete
Clear SheetSheets(“Sheet1”).Cells.Clear
Unprotect (No Password)Sheets(“Sheet1”).Unprotect
Unprotect (Password)Sheets(“Sheet1”).Unprotect “Password”
Protect (No Password)Sheets(“Sheet1”).Protect
Protect (Password)Sheets(“Sheet1”).Protect “Password”
Protect but Allow VBA AccessSheets(“Sheet1”).Protect UserInterfaceOnly:=True
Activate CellRange(“B3”).Activate
Cells(3,2).Activate
Select RangeRange(“a1:a3”).Select
Range(Range(“a1”), Range(“a3”)).Select
Range(Cells(1, 1), Cells(3, 1)).Select
VBA Cheat Sheet

Cells & Ranges:

DescriptionVBA Code
Activate CellRange(“B3”).Activate
Select RangeRange(“a1:a3”).Select
ResizeRange(“B3”).Resize(2, 2).Select
OffsetRange(“B3”).Offset(2, 2).Select
CopyRange(“A1:B3”).Copy Range(“D1”)
CutRange(“A1:B3”).Cut Range(“D1”)
DeleteRange(“A1:B3”).Delete
ClearRange(“A1:A3”).Clear
CountRange(“A1:A3”).Count
Set to VariableDim rng as Range
Set rng = Range(“A1”)
Merge/UnMergeRange(“A1:A3”).Merge
Range(“A1:A3”).UnMerge
Loop Through CellsDim cell As Range
For Each cell In Range(“A1:C3”)
MsgBox cell.Value
Next cell
Cell Cheat Sheet

Columns Cheat Sheet:

DescriptionVBA Code
ActivateColumns(1).Activate
Columns(“a:a”).Activate
Range(“a1”).EntireColumn.Activate
Height / WidthRange(“A1”).EntireColumn.ColumnWidth = 30
DeleteRange(“A1”).EntireColumn.Delete
CountRange(“A1”).Columns.Count
InsertRange(“A1”).EntireColumn.Insert
LastDim lCol as Long
lCol = Cells(1, Columns.Count).End(xlToLeft).Column
CopyRange(“A:A”).Copy Range(“E:E”)
InsertRange(“A:A”).Copy
Range(“E:E”).Insert
Column

Arrays:

DescriptionVBA Code
CreateDim arr(1 To 3) As Variant
arr(1) = “one”
arr(2) = “two”
arr(3) = “three”
Create From ExcelDim arr(1 To 3) As Variant
Dim cell As Range, i As Integer
i = LBound(arr)
For Each cell In Range(“A1:A3”)
i = i + 1
arr(i) = cell.Value
Next cell
Read All ItemsDim i As Long
For i = LBound(arr) To UBound(arr)
MsgBox arr(i)
Next i
EraseErase arr
Array to StringDim sName As String
sName = Join(arr, “:”)
Increase SizeReDim Preserve arr(0 To 100)
Set Valuearr(1) = 22
Arrays Cheat Sheet

Data & Time Excel Cheat Sheet

DescriptionExcel Formula
=EDATEAdds a specified number of months to a date in Excel
=EOMONTHConverts a date to the last day of the month (e.g., 7/18/2018 to 7/31/2018)
=DATEReturns a number that represents the date (yyyy/mm/dd) in Excel. Useful when working with functions that have a date as an argument.
=TODAYInserts and displays today’s date in a cell
=NETWORKDAYSReturns the number of whole workdays between two specified dates
=YEARExtracts and displays the year from a date (e.g., 7/18/2018 to 2018)
=YEARFRACExpresses the fraction of a year between two dates (e.g., 1/1/2018 – 3/31/2018 = 0.25)
Convert Time to SecondsConverts an amount of time to seconds (e.g., 5 minutes to 300 seconds)
Try these in formula bar of your excel sheet

Lookup Excel Formulas:

DescriptionExcel Formula
INDEX MATCHA combination of lookup functions that are more powerful than VLOOKUP
=VLOOKUPA lookup function that searches vertically in a table
=HLOOKUPA lookup function that searches horizontally in a table
=INDEXA lookup function that searches vertically and horizontally in a table
=MATCHReturns the position of a value in a series
=OFFSETMoves the reference of a cell by the number of rows and/or columns specified

Mathematical Functions Formulas:

DescriptionExcel Formula
=SUMAdd the total of a series of numbers
=AVERAGECalculates the average of a series of numbers
=MEDIANReturns the median average number of a series
=SUMPRODUCTCalculates the weighted average, very useful for financial analysis
=PRODUCTMultiplies all of a series of numbers
=ROUNDDOWNRounds a number to the specified number of digits
=ROUNDUPRounds a number to the specific number of digits
AutoSumA shortcut to quickly sum a series of numbers
=ABSReturns the absolute value of a number
=PIReturns the value of pi, accurate to 15 digits
=SUMIFSum values in a range that are specified by a condition
=SUMQReturns the sum of the squares of the arguments
Maths Formula

Let me know to help you with some financial formulas:

DescriptionExcel Formula
=NPVCalculates the net present value of cash flows based on a discount rate
=XNPVCalculates the NPV of cash flows based on a discount rate and specific dates
=IRRCalculates the internal rate of return (discount rate that sets the NPV to zero)
=XIRRCalculates the internal rate of return (discount rate that sets the NPV to zero) with specified dates
=YIELDReturns the yield of a security based on maturity, face value, and interest rate
=FVCalculates the future value of an investment with constant periodic payments and a constant interest rate
=PVCalculates the present value of an investment
=INTRATEThe interest rate on a fully invested security
=IPMTReturns the interest payments on a debt security
=PMTReturns the total payment (debt and interest) on a debt security
=PRICECalculates the price per $100 face value of a periodic coupon bond
=DBCalculates depreciation based on the fixed-declining balance method
=DDBCalculates depreciation based on the double-declining balance method
=SLNCalculates depreciation based on the straight-line method

Condition Formulas For Excel:

DescriptionExcel Formula
=IFChecks if a condition is met and returns a value if yes and if no
=ORChecks if any conditions are met and returns only “TRUE” or “FALSE”
=XORThe “exclusive or” statement returns true if the number of TRUE statements is odd
=ANDChecks if all conditions are met and returns only “TRUE” or “FALSE”
=NOTChanges “TRUE” to “FALSE”, and “FALSE” to “TRUE”
IF ANDCombine IF with AND to have multiple conditions
=IFERRORIf a cell contains an error, you can tell Excel to display an alternative result
Conditional Formulas

Arithmetic Operators:

DescriptionExcel Code
Add two values=A2 + A3
Subtract a value from another=A4 – B4
Multiply two values=A6 * B1
Divide two values=C3 / B4
Convert a value to a percentage=C5%
Raise a value to power=B1 ^ C1

Datatypes:

DescriptionExcel Code
Checks if a cell is a number=ISNUMBER(A1)
Checks if a cell is a text=ISTEXT(D1)
Checks if a cell is a boolean=ISLOGICAL(A1)
Checks if a cell is a boolean=ISLOGICAL(A1=A1)
Converts to number=N(E1)
Converts to number=N(D1)
Convert to text=VALUETOTEXT(A1)
Convert to formatted text=TEXT(C6, “0.00E+0”)
Convert text to serial=DATEVALUE(“1/1/2022”)

Counting Data:

DescriptionExcel Code
Returns the number of cells in the range containing numbers, dates, and currencies=COUNT(A5:E5)
Returns the number of cells in the range that aren’t empty=COUNTA(A5:E5)
Returns the number of cells that are empty or contain the empty string (“”)=COUNTBLANK(A5:E5)

Data Manipulation:

DescriptionExcel Code
Gets a subset of the cell range in the first input that meets the condition in the second input.=FILTER(A1:B6, C1:C6>100)
Returns the dataset with rows in alphabetical order of the fourth column. Sorts the rows of the data according to values in specified columns.=SORT(A1:E6, 4)
Returns the same as the SORT() example. Alternate, more flexible, syntax for sorting. Rather than specifying the column number, you specify an array to sort by.=SORTBY(A1:E6, D1:D6)
Gets a list of unique values from the specified data.=UNIQUE(A1:A6)
Returns 5 rows and 1 column containing the values 3, 5, 7, 9, 11. Generates a sequence of numbers, starting at the specified start value and with the specified step size.=SEQUENCE(5, 1, 3, 2)

Specifying absolute cell references with $ prefixes:

The $ symbol before the column letter and/or row number tells Excel that the reference is absolute and should not change when the formula is copied or moved to another cell. The following examples all specify column B, row 2.

DescriptionExcel Code
Column and row references are both absolute=$B$2
Column reference is absolute, row reference is relative=$B2
Column reference is relative, row reference is absolute=B$2

In conclusion, mastering Excel and VBA can significantly boost your productivity and effectiveness in handling data-related tasks. With this cheat sheet, you have a quick reference guide to essential Excel and VBA functions, formulas, and shortcuts that can save you time and effort. Keep this cheat sheet handy, and you’ll be equipped to tackle any Excel challenge that comes your way. Don’t miss out on this valuable resource that can elevate your Excel skills to the next level.

Author

Sona Avatar

Written by

Leave a Reply

Trending

CodeMagnet

Your Magnetic Resource, For Coding Brilliance

Programming Languages

Web Development

Data Science and Visualization

Career Section

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4205364944170772"
     crossorigin="anonymous"></script>