Counting Instance on One Sheet and Returning the Number on Another Sheet

Tuffman

New Member
Joined
May 31, 2012
Messages
49
Office Version
  1. 2016
Platform
  1. Windows
I need help in writing the VBA code that will do the following:

  • On Cars Database worksheet, search through column A for Toyota
  • When Toyota is found, for the condition of Toyota and Black, count the number of 4-Runners
  • Display/paste that number in cell A3 on Sheet2


Any help would be appreciated.

1726594629556.png
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’).

If you have Excel 2016 or newer, you should be able to do this pretty easily with a COUNTIFS formula.
See here an explanation and examples of how to use this function: COUNTIFS function - Microsoft Support
 
Upvote 0
If you have the latest version of Excel 365 Insider Beta, then you can use the GroupBy function.
or
You can Group the results using Power Query.

Additionally, Cannot manipulate data in a picture. Re post using MrE XL2BB function.
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,127
Members
453,021
Latest member
Justyna P

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
Back
Top