Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi. This small demo returns 3. Not sure if this covers all situations
though. Sub Demo() Dim s, t Dim n As Long '// Put formula in B1 [B1].Formula = "=IF(A1=1,10,IF(A1=2,20, IF(A1=3,30)))" '// Then... s = [B1].Formula t = Replace(s, "IF(", vbNullString) n = (Len(s) - Len(t)) / 3 Debug.Print n End Sub HTH -- Dana DeLouis Win XP & Office 2003 "ExcelMonkey" wrote in message ... Can anyone tell me how to count nested if statements in a formula via VBA. That is I want to be able to go into a cell and assess that the formula below has three IF stmts =IF(XXXXXXX,IF(XXXXXXX, IF(XXXXXX))) This may be a Regular Expression question. Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Nested IF statements | Excel Worksheet Functions | |||
Nested if statements - is there a better way? | Excel Worksheet Functions | |||
Nested IF statements | Excel Discussion (Misc queries) | |||
Nested IF statements | Excel Worksheet Functions | |||
nested statements | New Users to Excel |