• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Adding Rows in Excel

Sir/Madam,

On my attached sheet, 'Totals' is to be a count of all the different vehicle types on the 'Type' sheet.  When I am looking to have done is to have the count of the 'Type of Vehicle' in the 'Type' sheet placed into the appropriate cell on the 'Totals' sheet.  For my example, on the 'Total's sheet, it should say: Cars - 3, Trucks 4.  (this is a 1% sample of my data - my actual data is 90,000+ rows, with many different types of vehicles).  

I know I can perform a sort/filter to get my totals, but wanted to see if I could get a macro or something to do it for me instead since the numbers are always changing.  In addition, once you get me started with a macro, then I can add the other vehicle types.

Please advise with any questions.

Thank you,
James
ExpertsExchange-Question8.xlsx
0
James0903
Asked:
James0903
  • 2
1 Solution
 
Saqib Husain, SyedEngineerCommented:
If you make A3=CAR and A4=TRUCK on the totals sheet then enter this formula in B3 and copy down

=SUMIF(Type!B:B,SUBSTITUTE(A3,"TOTAL OF ",""),Type!C:C)
0
 
James0903Author Commented:
Thank you.  I have performed this but not sure why it is not working.  Did I enter incorrectly?  (see attached).
ExpertsExchange-Question8.xlsx
0
 
BullmanTechCommented:
You need a COUNTIF, not s SUMIF.

Put the following in cell B3 on the Totals worksheet and copy it down to B4 as well.

=COUNTIF(Type!B:B,Totals!A3)
0
 
James0903Author Commented:
That worked.  Thank you!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now