Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi all,
I was hoping for some advice - I've got Index function pulling data and (as expected) in cases where the data-source cell is "", the Index returns '0'. The point is that both "" and Zeros are valid values in the data-source cells and what I'd need would be the cell, that contains the Index would return exactly what's in the data-source cells - if source= "", then would return "", if zero or anything else - would return zero or anything else. Currently I'm using the: If(Index="","",index) but because the 'Index' bit is actually quite a long statement, the function is just way too long for my liking and i was hoping there was a smarter way of achieving the same result. The Tools-options-zero or Cell formatting doesn't work as it hides also the valid zeros... What seem to work is UDF: Public Function nonzero(myLookup) If myLookup = vbNullString Then nonzero = vbNullString Else nonzero = myLookup End If End Function And then in the cell I'd have =nonzero(index). But, (1) i don't know if the code i've written is correct (i.e., if "vbnullstring" is the constant i should be using); (2) it requires users to enable macros as otherwise the function wouldn't work. So, all in all, i was hoping that there was a bit more elegant/ accurate solution than the above and perhaps using just .xls default functions (i.e., avoiding UDF/xla etc.). Any ideas appreciated! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding a string of unknown length in a string of unknown length, Help! | Excel Discussion (Misc queries) | |||
Finding cells of different string length. | Excel Discussion (Misc queries) | |||
String length | Excel Discussion (Misc queries) | |||
Word could not parse your query options into a valid sql string | Excel Discussion (Misc queries) | |||
Valid SQL string | Excel Discussion (Misc queries) |