x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 1586

# Excel Formula - VLOOKUP with Count

I have the following formula in a cell, which will display either 'Y' or 'N' (possibly '')

=IF(OR(\$H288 = "", \$H288 = "Monthly Totals:"), "", IF(ISERROR(VLOOKUP(\$H288,DecemberPayees,1,FALSE)), "N","Y"))

I use it as part of my 'check ledger' to make sure I've accounted for a recurring payee. If I've created an entry in the range 'DecemberPayees' (which changes monthly), a 'Y' will be displayed. In some cases, I make bi-weekly payments, which means that I really don't want to display 'Y' unless there are at least 2 (yes, I know there can sometimes be 3 pay periods in a month, if you figure out how to determine that and adjust the formula accordingly, I'll figure out some way to give you extra points).

Basically, for biweekly payments, the VLOOKUP needs to find 2 occurrences of the payment in the named range.
0
dbbishop
1 Solution

Commented:
Hi dbb,

Since you're not using the return value of vlookup, why not use COUNTIF instead?

=IF(OR(\$H288 = "", \$H288 = "Monthly Totals:"), "", IF(COUNTIF(DecemberPayees,\$H288)=1, "N","Y"))

Change the =2 to test for 2, etc. If you want to see if its there at least one, then do >0 instead of =1.

Matt
0

Author Commented:
Is there an A+ ? Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.