Title. Could you? I've been wondering for a long time...
Title. Could you? I've been wondering for a long time...
no I couldn't - not enough years left in the locker and microsoft keeps adding new functions ...
and I wouldn't want to use them anyway - UDF would be slower than built-in functions..so why bother....
Last edited by kev_; 09-10-2017 at 01:18 PM.
Click *Add Reputation to thank those who helped you. Ask if anything is not clear
I meant like, theoretically... is there any function that does stuff that can't be replicated by VBA? guess that's the real question :P
Everything but the IF function, I expect, for its ability to minimally evaluate its arguments.
Entia non sunt multiplicanda sine necessitate
Off the top of my head, I cannot think of any of Excel's built in functions that could not be replicated in VBA or other programming language. As kev_ notes, there could be some discussion about whether VBA is a good programming language for performing any of these tasks, but I would be optimistic that the algorithms behind any of Excel's functions could be replicated in VBA.
Originally Posted by shg
Theoretically, yes they all could be recreated. VBA's extensible programming allows for using other scripting languages and libraries to expand it capabilities. It would not always yield the most efficient code to perform the task due to so many levels of indirection during execution. Low level langage programming always yields the best in speed but is far more difficult to code in. The programmer ultimately is faced with trade offs between speed, flexibility, and efficiency.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Star below the post.3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
VBA couldn't do the selective argument evaluation that IF does.
VBA could use other scripts to create a praser to solve the issue. It may not be pretty but possible.
how about a Forum team-building exercise?
- ask for volunteers to take part in the challenge
- one volunteer to list all the Excel functions
- every other volunteer to adopt one Excel function
- adopted function to be replicated without using any Excel function or VBA function that mimics an Excel function I
Gosh, that sounds like fun ...
I'm not sure what you mean.
What values would this return different than Excel's IF.
Please Login or Register to view this content.
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
Watch this evaluate (or not; you know what it does ):
=IF(SQRT(4)=2, 1, NORM.S.INV(RAND()))
In VBA, you'll get handed the result of the value-if-false clause. The IF function doesn't bother evaluating it.
wait, why not? Why is excel's IF any different than VBA's? I though I could write it in VBA in 1 minute unless I don't get what you're saying...
I liked the idea but we'd probably have to narrow it down to some function categories (probably exclude all financial and mathematical functions). after all there's like hundred of functions. Also off the top of my head I literally can't think of any basic function that I can't write in VBA. Then there's functions that it's not clear what they do or what the algorithm is. An example of the former is ENCODEURL I guess. But I suppose it's just a matter of understanding each function. So I guess it would be kind of pointless :phow about a Forum team-building exercise?
- ask for volunteers to take part in the challenge
- one volunteer to list all the Excel functions
- every other volunteer to adopt one Excel function
- adopted function to be replicated without using any Excel function or VBA function that mimics an Excel function I
I suppose you're right but it would still work. I'm not saying that under the scenes Excel functions aren't faster. I'm saying they can probably all be replicated by VBA...In VBA, you'll get handed the result of the value-if-false clause. The IF function doesn't bother evaluating it.
@shg - your enthusiasm is to be applauded.....but....what a mammoth project.........scares me ..... and it was my (very) tongue-in-cheek suggestion.....
Hey Kev.
I read post #10 as sarcasm - given away by the "Gosh"
If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)
You can't do one thing. XLAdept
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin
@xladept I was taught by my mother that "only the Brits" understand sarcasm...
Funnily enough "gosh" makes it sound less sarcastic.
Last edited by kev_; 09-10-2017 at 05:41 PM.
@ Kev - I read that as sarcasm
@xladept - that is quite amazing.... "one nation divided by a common language" is clearly no longer true
Awwww - Gosh
I wasn't arguing that you can't achieve the same functional result, mike, only that a VBA function can't do its own argument evaluation. I think it was a nice touch by Excel's designers, especially considering that about half of all functions used in Excel are IF.
Bingo.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks