NewOrderFac33
Well-known Member
- Joined
- Sep 26, 2011
- Messages
- 1,283
- Office Version
- 2016
- 2010
- Platform
- Windows
Good morning,
I have just spent hours poring over some data where I could have saved myself a lot of trouble with a simple formula.
I have a range of cells containing labels such as "Live, Pre-Production", "UAT, Pre-Production, Live", "Live, Inactives, UAT, Development" etc.
I needed to count the number of items in each cell, assuming that they were separated by commas. So, the formula would need to return the value 2 for the first of my examples, 3 for the second and 4 for the third.
It needs to use the logic "If the cell is blank, return 0, if the cell is not blank, but does not contain a comma, return 1, otherwise, return (number of commas +1) i.e. if there are two commas in the string, then there must be three items, and so on.
I understand the logic of what I'm trying to do, I'm just stuck on the bit that counts the number of commas found in the string - can anyone help?
As always, all advice gratefully received!
Pete
I have just spent hours poring over some data where I could have saved myself a lot of trouble with a simple formula.
I have a range of cells containing labels such as "Live, Pre-Production", "UAT, Pre-Production, Live", "Live, Inactives, UAT, Development" etc.
I needed to count the number of items in each cell, assuming that they were separated by commas. So, the formula would need to return the value 2 for the first of my examples, 3 for the second and 4 for the third.
It needs to use the logic "If the cell is blank, return 0, if the cell is not blank, but does not contain a comma, return 1, otherwise, return (number of commas +1) i.e. if there are two commas in the string, then there must be three items, and so on.
I understand the logic of what I'm trying to do, I'm just stuck on the bit that counts the number of commas found in the string - can anyone help?
As always, all advice gratefully received!
Pete