I'm new to VBA and just starting to try working with array formulas. I have two functions that I can't figure out how to do in VBA.
1. I want to create a function called =ifIs(CheckItem,CheckRange)
CheckItem is a cell that has string. CheckRange is a range with a string array.
if checkItem is blank, I'd like ifIs to return an array of 1s the length of the CheckRange.
If checkItem is a string, I'd like ifIs to return and of 1 if that matches that column in checkRange, and 0 if it does not match.
The array formula in Excel is
={IF(CheckItem="",Ones,--(CheckRange=CheckItem))}
"Ones" is a range name that refers to a column of ones the same length as CheckRange. I'd like the udf to have only two inputs, however, checkItem and checkRange.
Ideally, I'd also like ifIs() to not have any loops. The function will be used on large columns of numbers so speed of execution is important.
2. I'd also like to create a UDF called TMM(vector,Matrix)
The TMM function would return as an array with the same number of columns as the matrix.
In the example spreadsheet,
=MMULT(TRANSPOSE(B10:B14),C3:E7)
would return {25 24 25}
My goal is to use these functions as building blocks for bigger formulas. I'd be grateful for any help getting started.
Bookmarks