
I need help with a function which will find all values of 1 in column A (e.g. A1). For each value of 1, I need the function to count the number of IP addresses beginning with either 178. or 14. in the corresponding column B (e.g. B1). The IP addresses are separated by a comma & space, e.g. 178.5.4.3, 178.5.4.4
I was able to count the total instances of 178. in column B using this formula:
=SUM(LEN(A2:A11)-LEN(SUBSTITUTE(A2:A11,"178.",""))/LEN("178."))
Or this one by adding four spaces in the substitute function:
=SUM(LEN(A2:A11)-LEN(SUBSTITUTE(A2:A11,"178."," ")))
But, I cannot seem to find a way to search for a 1 in column A (without counting it) and then count the number of 178. and 14. in the corresponding B column.
The purpose is to find out how many IP addresses are in use in zone 1, 2, 3, etc.
1 14.38.227.88
1 14.38.227.103
1 14.38.227.104
2 178.32.38.106, 178.32.34.241, 178.32.33.65, 178.32.32.20, 178.32.34.135
2 178.32.38.187, 178.32.38.52, 178.32.38.50, 178.32.38.4, 178.32.36.223, 178.32.35.197, 178.32.34.254, 178.32.32.160, 178.32.32.159, 178.32.32.76, 178.32.32.39, 178.32.32.38, 178.32.32.26
3 178.32.33.61, 178.32.33.57
3 178.32.38.180, 178.32.38.119, 178.32.38.64, 178.32.38.62, 178.32.37.215, 178.32.35.108, 178.32.35.42, 178.32.34.242, 178.32.34.237, 178.32.34.1, 178.32.33.60, 178.32.33.59, 178.32.32.78, 178.32.33.56
4 178.32.39.6, 178.32.38.186, 178.32.38.115, 178.32.38.58, 178.32.37.216, 178.32.34.236, 178.32.33.206, 178.32.33.66, 178.32.33.55, 178.32.33.54, 178.32.32.77, 178.32.32.40, 178.32.32.33, 178.32.38.166
4 178.32.33.53, 178.32.38.167
4 178.32.33.68

Assuming no
Excel Constraintsas per the tags posted, then the following formulas should work to accomplish the desired output.• Formula used in cell A12
Edit:
As per comments of OP
• Formula used in cell A12
IPaddresses data into columns,Zonesstacked into a single column for those haveIPaddresses starting with178.&14.by excluding the rest which don't start with the same.Also, the above formula assumes per row there will be a max of
99IP Addresses, if its not, then replace the99with this to make it dynamic --MAX(LEN(B1:B10)-LEN(SUBSTITUTE(B1:B10,",",))+1), that said the formula will be,Updated Formula:
The formula is updated as per OP's comments:
OP Says:
• Formula used in cell C1