Solved

# EXCEL MATH TO SQL

Posted on 2011-10-25
Medium Priority
319 Views
Hi All,

I have below excel math :

=FLOOR(LOG(Number,2),1)+1

How to convert it into MS SQL ?

Thank you.
0
Question by:emi_sastra
• 4
• 3

LVL 74

Expert Comment

ID: 37029065
floor(log(number)/log(2))+1
0

LVL 74

Expert Comment

ID: 37029066
you could also use log10  instead of log

0

LVL 1

Author Comment

ID: 37029093
Hi sdstuber,

- floor(log(number)/log(2))+1
It works.

- you could also use log10  instead of log
How to do this ?

Thank you.
0

LVL 74

Expert Comment

ID: 37029098
floor(log10(number)/log10(2))+1
0

LVL 1

Author Comment

ID: 37029105
What makes it different ?

Would you please make correction of my code below ?

SELECT FLOOR(LOG(
SELECT COUNT(*) AS TotalMember
FROM TMMEMBERDATA) / LOG(2))+1

Thank you.
0

LVL 74

Accepted Solution

sdstuber earned 2000 total points
ID: 37029110
select floor(log(count(*))/log(2))+1 from tmmemberdata
0

LVL 1

Author Comment

ID: 37029118
Great.

Thank you very much for your help.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
###### Suggested Courses
Course of the Month14 days, 17 hours left to enroll