ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   what is a dumb or smart formula (https://www.excelbanter.com/excel-worksheet-functions/50581-what-dumb-smart-formula.html)

dede

what is a dumb or smart formula
 
our professor is asking us the difference between a dumb formula and a smart
formula and give an example. Any ideas?

RagDyer

I've never explicitly heard of that before.

Maybe he means a formula that contains some type of error checking as being
"smart".

=A1/B1

As opposed to:

=IF(B1,A1/B1,"B1 Lacks Value")

--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"dede" wrote in message
...
our professor is asking us the difference between a dumb formula and a

smart
formula and give an example. Any ideas?



Biff

Hi!

The concept is really open to interpretation!

In my opinion a "smart" formula is one that accounts for all the possible
things that might cause the formula to fail. Fail meaning, returning
incorrect results.

A very simple "dumb" formula is:

=VLOOKUP(A1,Sheet2!A1:B100,2,0)

I'll let you figure out why it's "dumb"!

Biff

"dede" wrote in message
...
our professor is asking us the difference between a dumb formula and a
smart
formula and give an example. Any ideas?




Bernd Plumhoff

Hi dede,

If I interprete smart=efficient and dumb=not_as_efficient then this might be
your example:

Task: Count the occurences of Thursdays between 1-Jan-2005 and 26-Jan-2005.

"Dumb" function:
=SUM(--(WEEKDAY(ROW(INDIRECT(1/1/5&":"&1/26/5)))=4))

"Smart" function (by Daniel M.):
=INT((1/26/5-WEEKDAY(1/26/5+1-4)-1/1/5+8)/7)

Both functions calculate the correct result 4. But the "dumb" function needs
about 20x more execution time (due to FastExcel) since it first generates
the whole date sequence and counts all occurences then.

HTH,
Bernd



Richard Buttrey

On Fri, 14 Oct 2005 18:43:03 -0700, "dede"
wrote:

our professor is asking us the difference between a dumb formula and a smart
formula and give an example. Any ideas?


It really depends, as others have said, on your prof's definition of
dumb and smart.

I remember seeing an adult class of spreadsheet beginners, being shown
that the way to add the numbers in A1:A3 was to write A1+A2+A3, rather
than the rather obvious =SUM(A1:A3)

I suppose you could argue that the latter formula is smart since you
can add rows in between 1&3 without upsetting the accuracy of the
result.

Rgds
__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________

Biff

what is a dumb or smart formula
 
I'm feeling really dumb right now!

=SUM(--(WEEKDAY(ROW(INDIRECT(1/1/5&":"&1/26/5)))=4))
=INT((1/26/5-WEEKDAY(1/26/5+1-4)-1/1/5+8)/7)



As written, neither of those formulas work. If I replace the date strings
with either cell references or use an addional function, Datevalue (which
would be dumb!), then they do work. The first formula is an array and can be
made a non-array by using Sumproduct.

The second formula is very nice (Daniel M. always comes up with these slick
date formulas!) but............

How (why?) does it work?

The only part of it that I understand is /7!

Please explain the logic..........

WEEKDAY(1/26/5+1-4)

Why do you add 1 then subtract 4? What is the significance of that? What
does that mean?

Same thing for:

1/1/5+8

Why do you add 8 to the start date? What is the significance of that? What
does that mean?

Here's another thing to consider regarding the topic of this thread: How
does one know if their solution is "dumb" or "smart" ?

Is it "dumb" to use formulas you don't understand?

Biff

"Bernd Plumhoff" wrote in message
...
Hi dede,

If I interprete smart=efficient and dumb=not_as_efficient then this might
be your example:

Task: Count the occurences of Thursdays between 1-Jan-2005 and
26-Jan-2005.

"Dumb" function:
=SUM(--(WEEKDAY(ROW(INDIRECT(1/1/5&":"&1/26/5)))=4))

"Smart" function (by Daniel M.):
=INT((1/26/5-WEEKDAY(1/26/5+1-4)-1/1/5+8)/7)

Both functions calculate the correct result 4. But the "dumb" function
needs about 20x more execution time (due to FastExcel) since it first
generates the whole date sequence and counts all occurences then.

HTH,
Bernd




Bernd Plumhoff

what is a dumb or smart formula
 
Hi Biff,

Was working with my German Excel version:
1/26/2005 should be the date constant 26-Jan-2005. Please enter the constant
38378.
1/1/2005 should be 1-Jan-2005. Please enter 38353.

Regards,
Bernd




All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com