Count the number of distinct subsets of a string that match a criteria

Options

I need to create a formula to count the number of distinct subsets of a string that match a criteria.

For example.

I have a sheet with a column foo. the foo column contains the following

A-Z

A-Y

A-Z

A-X

A-Y

B-A

B-B

C-D

C-D


I need a formula that looks at this column and returns the number of distinct A(s) which would be three in my example. One for A-Z, one for A-Y and one for A-X.


Thanks in advance,

Nick

Best Answer

  • Mark Cronk
    Mark Cronk ✭✭✭✭✭✭
    Answer ✓
    Options

    Hi @Nick DeMarco ,

    Try this:

    =COUNT(DISTINCT(COLLECT(FOO:FOO, FOO:FOO, FIND("A", @cell) = 1)))

    It should work for your example. But, it is hard coded for your example and the logic may not work for your real use case.

    Help at all?

    Mark


    I'm grateful for your "Vote Up" or "Insightful". Thank you for contributing to the Community.

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!