I have posted this question at Mr Excel but they could not help me due to not having an image and my unclear requirements (which I have corrected here).
https://www.mrexcel.com/forum/excel-...e-count-2.html
I was looking for help on adding on some code to find numbers 1 to 20 that have sets of numbers in the adjacent cell.. The code below works.
The code searches 3 ranges D3:D10, G12:G18, I1:I10 ((I will need to be able to add additional ranges in the future). There are numbers (ranging from 1 to 20) in each cell. What I require the code to do for a positive result is to check the cells to the adjacent right of each number in the range for set of numbers in them.Sub CountSetData() Range("B2").Value = 0 Range("B2").Value = Range("D3:D10,G12:G18,I1:I10").SpecialCells(xlConstants).Count End Sub
So in my sample data cell D4 has number 7 in it but no set of numbers (2-2 or 99-1 etc.) in cell E4 it so that would be a negative result but in cell E5 which has 1 in it and a 1-1 in cell F5 that is a positive result and what needs to be counted and written to cell B2. The other two positive examples are cell G14 and cell I6. All threw would be counted as a positive result and written to cell B2. There will always be a set of numbers somewhere beside the ranges and so always have a positive result. The expected result is 3 in cell B2.
The 3 cell range are formatted as general and the sets of numbers are formatted as text.
That would do it. Thanks so much for all your help.
find numbers.png
Bookmarks