Searching two different columns

bushd

New Member
Joined
Jan 17, 2005
Messages
5
The title would have been too long for its real name. Searching two different columns with a set of data for each and each data match must be on the same row to be valid and add 1 to a counter.

Code:
Search1: bb     Search2: aa

     A    B    C    D
1   ab   x    aa  x
2   ac   x    aa  x
3   bb   x   aa   x
4   bb   x   ab   x
The code I want would search Column A for bb and find 2 and on searching column C would find 3 aa but on the row match it would only give 1. Also, the Search1 and Search2 data in my setup is a validate list dropdown so it has the ability to change -- Hopefully that affects nothing. I am thinking this will be required to be in VB because a day of searching through posts on here has turned up nothing.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,257
On the face of it, this seems like a simple AutoFilter issue. Just filter the range in the two fields of interest, and because AutoFilter is an "and" filter feature, you'd only get the cells visible (filtered) which meet the criteria for each field taken together, which sounds like what you're after, unless there's more to this.
 

bushd

New Member
Joined
Jan 17, 2005
Messages
5
Well, I do not need it to hide or move any data. It just needs to be a tally or 0,1,2,3 etc of however many items fit the two Searches. There is also the possibility of third search item addition but that is in the future. This is mean to control an Appointment schedule and tally daily appointments at a location specified.
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,257
Well, as predisposed as I usually am to VBA solutions, would a simple formula do what you want? Modify for range:

=SUMPRODUCT(--(A1:A10="bb"),--(C1:C10="aa"))
 

Forum statistics

Threads
1,148,396
Messages
5,746,452
Members
424,020
Latest member
LongDoo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top