Formula for Data Sizes (B, KB, MB, GB)

ildanach

New Member
Joined
Aug 11, 2008
Messages
13
Hey folks,

I use an application that reports data size usage by date. You can see the screenshot below of how it exports its results to excel.
dailyreport.jpg


I was wondering if there was a way to right a formula that will ignore the 'B', 'KB', 'MB' and calculate the total data size in MB's or GB's using the 1024b per meg and so on.

If not I was wondering is it possible to create my own custom data type where I can specify the parameters for calculating in data sizes?

Thanks a million in advance!
ildanach
 
Do you mean something like this? This will only sum up the values though, doesn't see if it's MB or GB. Will try to work something out now!

Excel Workbook
AB
1Usage
2Monday140.86 MB
3Tuesday500 MB
4Wednesday254.87 MB
5Thursday1.45 MB
6Friday87.14 MB
7
8Total984.32
Sheet1
 
Upvote 0
Here we go:

Excel Workbook
AB
1Usage
2Monday140.86 MB
3Tuesday512 B
4Wednesday512 KB
5Thursday1.45 GB
6Friday87.14 MB
7
8Total1713.3005
Sheet1



This will give the total size in MB! If you want if displayed in GB, divide by 1024 etc..
 
Upvote 0
Hi ildanach
Welcome to the board

Another option:

=SUM(LEFT(B2:B6,FIND(" ",B2:B6))*IF(RIGHT(B2:B6,2)={"GB","MB","KB"," B"},1024^{1,0,-1,-2}))
Confirmed with CTRL-SHIFT-ENTER
 
Upvote 0
Hi ildanach
Welcome to the board

Another option:

=SUM(LEFT(B2:B6,FIND(" ",B2:B6))*IF(RIGHT(B2:B6,2)={"GB","MB","KB"," B"},1024^{1,0,-1,-2}))
Confirmed with CTRL-SHIFT-ENTER
That's awesome. Great work!
 
Upvote 0
Here we go:

Sheet1

*AB
*Usage
Monday140.86 MB
Tuesday512 B
Wednesday512 KB
Thursday1.45 GB
Friday87.14 MB
**
Total

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:80px;"><col style="width:69px;"></colgroup><tbody>
[TD="bgcolor: #cacaca, align: center"]1[/TD]

[TD="bgcolor: #cacaca, align: center"]2[/TD]

[TD="bgcolor: #cacaca, align: center"]3[/TD]

[TD="bgcolor: #cacaca, align: center"]4[/TD]

[TD="bgcolor: #cacaca, align: center"]5[/TD]

[TD="bgcolor: #cacaca, align: center"]6[/TD]

[TD="bgcolor: #cacaca, align: center"]7[/TD]

[TD="bgcolor: #cacaca, align: center"]8[/TD]

[TD="align: right"]1713.3005[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
B8{=SUMPRODUCT(--(LEFT(B2:B6,FIND(" ",B2:B6)-1))*(IF(RIGHT(B2:B6,2)="MB",1,IF(RIGHT(B2:B6,2)="GB",1024,IF(RIGHT(B2:B6,2)="KB",1/1024,IF(RIGHT(B2:B6,2)=" B",1/(1024^2),0))))))}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

=LEFT(A1,LEN(A1)-2)/1024^((MATCH(RIGHT(A1,2),{"PB","TB","GB","MB","KB"},0)-3))

This will give the total size in GB! If you want if displayed in MB, change last -3 to -4 or to Kb then -5 and so on
 
Upvote 0
When i try this formula i always get

There´s a probelm with this formula
Not trying to type a formula?
When the first charaters......


Any idea?
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top