Enter an Excel function above to see the VBA translation

Common Formula to VBA Examples

Click to view

SUM Function
=SUM(A1:A10)
Adds all values in the range A1 to A10
VLOOKUP Function
=VLOOKUP(B2,D:E,2,FALSE)
Looks up a value in the first column and returns a value in the same row from another column
IF Function
=IF(A1>10,"High","Low")
Returns "High" if A1 is greater than 10, otherwise "Low"
CONCATENATE Function
=CONCATENATE(A1," ",B1)
Joins text from A1 and B1 with a space in between
COUNTIF Function
=COUNTIF(A:A,">10")
Counts cells in column A that are greater than 10
INDEX/MATCH Combination
=INDEX(B:B,MATCH(E1,A:A,0))
More flexible alternative to VLOOKUP for exact matches