[SIZE=1]// Table1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Split = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Raw", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Raw"),
Type = Table.TransformColumnTypes(Split,{{"Raw", Int64.Type}}),
Condition = Table.AddColumn(Type, "IF", each if Number.IsEven([Raw]) then "Even" else if Number.IsOdd([Raw]) then "Odd" else null),
#"Grouped Rows" = Table.Group(Condition, {"IF"}, {{"Count", each Table.RowCount(_), type number}})
in
#"Grouped Rows"[/SIZE]
A | B | C | D | |
---|---|---|---|---|
Raw | IF | Count | ||
2,3,1,15,44,51,32,7,9,11 | Even | |||
Odd |
Function CountNums(rng As Range, typ As String) As Long
Dim arr() As String
Dim i As Long
Dim ct As Long
arr = Split(rng, ",")
For i = LBound(arr) To UBound(arr)
Select Case UCase(typ)
Case "ODD"
If Application.WorksheetFunction.IsOdd(arr(i)) Then ct = ct + 1
Case "EVEN"
If Application.WorksheetFunction.IsEven(arr(i)) Then ct = ct + 1
End Select
Next i
CountNums = ct
End Function
And, did you know that "never odd or even" is a palindrome?