Hello all - I am pretty new to VBA programming (just started 2 days ago). I was wondering if what I am trying to do is possible, I searched around online quite a bit before posting. Here's what I want to achieve. I am trying to do this is excel formulas first, and then create a macro out of it.
I have a big set of data with two columns of items that I would like to count. For example, my data that I want to count is in cell A1 and A2.
Say I have this:
Cell A1:::: L9, L10, L56, L23
Cell B1:::: L99, L41, L5
I want to count the number of "L?" that I have -- So for the example above, the count should be "7".
Or if I have the below data, the count should be "5".
Cell A1:::: L39, L15, L26, L43
Cell B1:::: L94
Or if I have the below data, the count should be "1".
Cell A1:::: L4
Cell B1:::: (blank)
I tried using the formula below by looking at values separated by commas, but as you can see...some of the data (particularly the last value) in a cell is not separated by a comma, so this formula did not work. Also if I have a single data point, this formula does not work.
=LEN(TRIM(H7))-LEN(SUBSTITUTE(TRIM(A1),",",""))+LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",","")) ....and similarly for A2.
I tried doing a "COUNTIF(A1,"L*"), but this does not count repetitive values.
Any tips that can help me out with this? I would like to create a macro with a click button that achieves this function.
Thanks in advance!
Bookmarks