Category Archives: Custom Functions VBA

How Use VBA To Evaluate Two Cells

This post is actually a response to a question someone had.

‪i need help comparing two cells with a high and low value, one of the cells is blue. Return 1 if the lowest value is blue color or return zero if the higher value is blue color. how do i perform this task in excel?‬

Here in this example we have 2 columns:

In order to evaluate the 2 columns, it’s best to generate a user defined function.

This is the code for the user defined function (in a module):

This is the way to call it from the worksheet:


and here is the end result:

Let me know if you have any questions.