Home » excel » In Excel, trim the last 3 characters and sum all the matching results

In Excel, trim the last 3 characters and sum all the matching results

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a huge CSV that contains file locations such as this:

\fileserver1\employees\production team\Reports\surveygroup\WIP 08052011.xls

But with all sorts of extensions. I want to be able to, on a separate sheet I have as a report, show a list of all the times a certain file type is used. For example, I want a report page that looks like this:

 .JPG    492
 .PDF    567
 .XLS    124

Thank you for anyone that can help!

How to&Answers:

Do you already have a distinct list of the extensions? If you do you can use a wildcard with countif.

=COUNTIF(A:A,"*jpg")

The * at the beginning will count any items that end with “jpg”. If those items are in a cell you can do the same thing by concatenating a wildcard with a cell value like this.

=COUNTIF(A:A,"*" & C1)

Answer:

I couldn’t find how to combine them together. But these two formulas will do the trick:

=RIGHT(E6,3)

Returns the last 3 letter in the cell

=COUNTIF(F6:F10,"jpg")

Counts up the instances of a given string.