473,657 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert gb or mb to zeros or decimal places

I know it's possible, just don't know how to do it. I have a
spreadsheet that I imported into access. Two of the columns in the
table have Hard Drive space values listed for example 2.45 GB and 453
MB, you get the picture. Both the GB and MB assorted values exist in
both columns.

Is there anyway to convert the GB or MB to 0's, or even better yet
decimal places so I can look for values < or > to 6gb. I already tried
a query, but it seems that in it's current format, access can't
properly run the query, because it's only looking at the numeric value
and not the gb or mb attached to it.

Or is it simpler to do in Excel?

TIA,

Brian
Nov 12 '05 #1
2 15859
Strictly, 1KB is 1024 bytes.
1MB is 1024 squared.
1GB is 1024 cubed.

Open the Immediate Window (Ctrl+G), and enter:
? CLng(1024) * 1024
1 048 576

? CLng(1024) * 1024 * 1024
1 073 741 824

The conversion to Long is necessary because of the size of the numbers. To
go much larger, you may need to convert to Decimal, i.e. use CDec() instead
of CLng().

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Bubba" <n3***@hotmail. com> wrote in message
news:cc******** *************** ***@posting.goo gle.com...
I know it's possible, just don't know how to do it. I have a
spreadsheet that I imported into access. Two of the columns in the
table have Hard Drive space values listed for example 2.45 GB and 453
MB, you get the picture. Both the GB and MB assorted values exist in
both columns.

Is there anyway to convert the GB or MB to 0's, or even better yet
decimal places so I can look for values < or > to 6gb. I already tried
a query, but it seems that in it's current format, access can't
properly run the query, because it's only looking at the numeric value
and not the gb or mb attached to it.

Or is it simpler to do in Excel?

TIA,

Brian

Nov 12 '05 #2
Probably need a column in your query calling the following function where
InputStr is defined as text in your table

Function Convert(InputSt r As String) As String

If IsNumeric(Input Str) Then
Convert = CDec(InputStr)
Exit Function
End If

If Right(InputStr, 2) = "mb" Then
Convert = CDec(Left(Input Str, Len(InputStr) - 2) * 1000000)
Exit Function
End If
If Right(InputStr, 2) = "gb" Then
Convert = CDec(Left(Input Str, Len(InputStr) - 2) * 1000000000)
Exit Function
End If

End Function

Phil
"Bubba" <n3***@hotmail. com> wrote in message
news:cc******** *************** ***@posting.goo gle.com...
I know it's possible, just don't know how to do it. I have a
spreadsheet that I imported into access. Two of the columns in the
table have Hard Drive space values listed for example 2.45 GB and 453
MB, you get the picture. Both the GB and MB assorted values exist in
both columns.

Is there anyway to convert the GB or MB to 0's, or even better yet
decimal places so I can look for values < or > to 6gb. I already tried
a query, but it seems that in it's current format, access can't
properly run the query, because it's only looking at the numeric value
and not the gb or mb attached to it.

Or is it simpler to do in Excel?

TIA,

Brian

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
11658
by: Gizmo | last post by:
Hi there i was wondering if any one new to a function that rounds up a float to so many decimal places. I have a number in bytes and converting it to mb's and gb's but once its converted i need to be able to do it to 2 decimal places. Thanks for any help Scott.
2
3090
by: Scott | last post by:
I want to display a decimal as a currency value for instance £65.00 or £58.47, but at the moment the code doesn't seem to work correctly. Can I declare this variable to be shown with 2 decimal places any easier??? Maybe at the start of the program?? Here is my code... o65 = CType(o65, Decimal).ToString("C") win17 = CType(win17, Decimal).ToString("C") total = CType(total, Decimal).ToString("C") total = price + o65 + win17
2
2765
by: Andy | last post by:
Hi I'm really stuck outputting a double number to the console with three decimal places if the furthest right value is a zero. I can coutput the number 4.546 as 4.546 but then if I output 0.220 it comes out as 0.22 and drops the zero. Also, outputting 1.000 outputs as 1. How can I format it to include the zeros?
52
1565
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places? ----------------------------------------------------------------------- When formatting money for example, to format 6.57634 to 6.58, 6.5 to 6.50, and 6 to 6.00? Rounding of x.xx5 is uncertain, as such numbers are not represented exactly.
19
3594
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm starting a new one] I'd still like to finish this rounding mess. As a startup lemma we can take that VK is the worst programmer of all times and places: let's move from here forward please. The usability of any program depends on exact behavior...
3
3843
by: =?Utf-8?B?U2NvdHQ=?= | last post by:
Hello, I would like to convert a double to a string and have the resulting string contain all of the original values after the decimal place. Currently, the problem that I am having is that the new string value is being rounded to nine decimal places. Dim dblX As Double = 146785.62713610753 dim strText as String = dblX.ToString()
10
1850
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places? ----------------------------------------------------------------------- When formatting money for example, to format 6.57634 to 6.58, 6.5 to 6.50, and 6 to 6.00? Rounding of x.xx5 is uncertain, as such numbers are not represented exactly. See section 4.7 for Rounding issues.
4
2786
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I format a Number as a String with exactly 2 decimal places? ----------------------------------------------------------------------- When formatting money for example, to format 6.57634 to 6.58, 6.5 to 6.50, and 6 to 6.00? Rounding of x.xx5 is uncertain, as such numbers are not represented exactly. See the section on "simple decimal arithmetic"
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.