Excel число в мегабайтах

If you are working with data related to storage space or file-size, you will often need to convert between units.

You might intend on using the data in calculations or you might just want all the sizes to be displayed in the same unit.

This would require you to convert the sizes, say bytes to MB / GB or vice-versa. 

In this tutorial, we will show you two different ways to convert bytes to MB or GB and vice-versa in Excel:

The basic method requires you to understand the relationship between the storage units and how to convert from one to the other.

In general, every unit grows by 1024. This means,

  • 1024 Bytes = 1 KB
  • 1024 KB = 1 MB
  • 1024 MB = 1 GB

And so on!

In other words, if you want to convert a storage size from bytes to MB, you need to divide it by 102 * 1024.

Similarly, to convert it to GB, you need to divide it by 1024 * 1024 * 1024.

Conversely, if you want to convert back, you need to multiply the storage size by 1024 each time.

This means that to convert from MB to Bytes, you need to multiply by 1024 * 1024. Similarly, to convert from GB to Bytes, multiply the number by 1024 * 1024 * 1024.

Converting Bytes to MB (Megabytes) and Vice versa

Let us say you have the following numbers in bytes and want to convert all of them to MB:

To convert from Bytes to MB, use the following formula (for row 2):

=A2 /( 1024 * 1024)

To convert from MB to Bytes, reverse the formula as follows (for row 2):

=A2 * 1024 * 1024

Note, instead of multiplying by 1024 so many times, you could also use the POWER function as follows:

=A2 / POWER(1024,2)

Or

=A2 * POWER(1024,2)

Converting Bytes to GB (Gigabytes) and Vice versa

If you have the same numbers in Bytes and want to convert all of them to GB instead, use the following formula (for row 2):

=A2 /( 1024 * 1024 * 1024)

To convert from GB to Bytes, reverse the formula as follows (for row 2):

=A2 * 1024 * 1024 * 1024

Alternatively, you could use the POWER function as follows:

=A2 / POWER(1024,3)

Or

=A2 * POWER(1024,3)

Converting MB to GB (Megabyte to Gigabyte) and Vice versa

Now consider the case where you have the following numbers in MB instead and want to convert all of them to GB:

In this case, you can use the following formula (for row 2):

=A2 /( 1024)

To convert from GB to MB,  reverse the formula as follows (for row 2):

=A2 * 1024
Also read: Convert KG to lbs (Pound) in Excel

Using the CONVERT Function to Convert Bytes to MB or GB

If you don’t want to go through the trouble of memorizing the conversion factors for storage size conversions, you can use the CONVERT function instead.

This function lets you convert numbers in one measurement system or unit to another. So, you can use it to convert Bytes to MB or GB and vice-versa.

The syntax for the CONVERT function is:  

=CONVERT (number, from_unit, to_unit)

 Here,

  • number is the numeric value (or cell reference containing the value) that you want to convert.
  • from_unit is the unit in which number is expressed.
  • to_unit is the unit to which you want to convert the number.

So if you want to convert the contents of cell A2 from Bytes to Kilobytes, you would use the CONVERT function as follows:

=CONVERT(A2,"byte","kibyte")

Note that there are fixed identifiers for the different units. You can use the following table to obtain the identifiers for your required storage units:

Unit Identifier
Byte byte
Kilobyte kibyte
Megabyte Mibyte
Gigabyte Gibyte
Terabyte Tibyte

Note that the CONVERT function is case-sensitive. So you need to make sure that the strings you use in the second and third arguments of the function are in the correct case.

If the function does not recognize a string, it will return a #N/A error.

It will also return an error if the units in the two parameters are not compatible.

Converting Bytes to MB and Vice versa

Let us say you have the following numbers in Bytes and want to convert all of them to MB:

To convert from Bytes to MB, use the following formula (for row 2):

=CONVERT(A2,"byte","Mibyte")

To convert from MB to Bytes, reverse the parameters as follows (for row 2):

=CONVERT(A2,”Mibyte”,”byte”)

Converting Bytes to GB and Vice versa

If you have the same numbers in Bytes and want to convert all of them to GB instead, use the following formula (for row 2):

=CONVERT(A2,"byte","Gibyte")

To convert from GB to Bytes, reverse the parameters as follows (for row 2):

=CONVERT(A2,"Gibyte","byte")

Converting MB to GB and Vice versa

Now consider the case where you have the following numbers in MB instead and want to convert all of them to GB:

In this case, you can use the following formula (for row 2):

=CONVERT(A2,"Mibyte","Gibyte")

To convert from GB to MB, reverse the parameters as follows (for row 2):

=CONVERT(A2,"Gibyte", "Mibyte")

In this tutorial we saw two ways of converting Bytes to MB or GB in Excel.

We also showed you how to convert MB and GB back to Bytes and how to convert between MB and GB.

The methods discussed in the tutorial can be extended to the other units of storage (like TB, PB) as well.

We hope the tutorial was helpful for you.

Other articles you may also like:

  • How to Convert Serial Numbers to Date in Excel
  • How to Convert Radians to Degrees in Excel (Easy Formula)
  • How to Convert Decimal to Fraction in Excel
  • How to Convert Month Number to Month Name in Excel
  • How to Convert Inches to MM, CM, or Feet in Excel?

Если у вас есть столбец чисел, единица измерения — КБ, и теперь вы хотите преобразовать единицы в МБ, ГБ или ТБ? Чтобы преобразовать единицы хранения, вы должны знать коэффициенты преобразования, а затем выполнить некоторые расчеты. В этой статье я расскажу о некоторых быстрых методах решения этой задачи.

Преобразование между kb и mb, gb, tb и наоборот с помощью формул

Преобразование между kb и mb, gb, tb и наоборот с помощью Kutools for Excel


Как мы все знаем, для единиц хранения коэффициент преобразования каждой смежной единицы равен 1024, поэтому вы можете конвертировать между ними следующим образом:

Преобразование между КБ и МБ:

Чтобы преобразовать единицы измерения из килобайт в мегабайты, примените эту формулу: = A2 / 1024, см. снимок экрана:

документ преобразовать кб мб 1

Если вы хотите преобразовать mb в kb, просто примените эту формулу: = A2 * 1024.

Tips: Для преобразования между kb и gb, tb:

КБ в ГБ: = A2 / 1024 ^ 2
ГБ в КБ: = A2 * 1024 ^ 2
КБ в ТБ: = A2 / 1024 ^ 3
ТБ в КБ: = A2 * 1024 ^ 3

Преобразование единиц: (Преобразование между несколькими единицами измерения, такими как время, расстояние, биты и байты и т. Д.)

Работы С Нами Kutools for ExcelАвтора Преобразование единиц измерения утилита, вы можете быстро конвертировать между несколькими единицами без каких-либо формул.

документ преобразовать кб мб 8


Если вас смущают приведенные выше формулы, здесь я могу рассказать о простом инструменте —Kutools for Excel, С его Преобразование единиц измерения функция, вы можете быстро и легко конвертировать между различными единицами.

1. Выберите диапазон данных, который вы хотите преобразовать.

2. Нажмите Кутулс > Содержание > Преобразование единиц измерения, см. снимок экрана:

3. В Преобразование единиц измерения диалоговом окне выполните следующие операции:

(1.) Выберите Биты и байты из Единицы падать;

(2.) Укажите единицы измерения, которые вы хотите преобразовать, в двух списках.

документ преобразовать кб мб 3

4. Затем нажмите Ok or Применить кнопки, числа переведены из kb в mb, см. скриншоты:

Ноты:

1. Если вы хотите преобразовать mb в kb, просто нажмите документ преобразовать кб мб 7обменять единицы.

2. Если вы проверите Добавить результаты как комментарий в диалоговом окне, преобразованные результаты будут вставлены в ячейки в виде комментариев, см. снимок экрана:

документ преобразовать кб мб 6

С помощью этой функции вы также можете преобразовывать углы, расстояния, температуры и т. Д.

Нажмите, чтобы узнать больше об этой утилите преобразования единиц …

Скачать и бесплатную пробную версию Kutools for Excel Сейчас !



Лучшие инструменты для работы в офисе

Kutools for Excel Решит большинство ваших проблем и повысит вашу производительность на 80%

  • Снова использовать: Быстро вставить сложные формулы, диаграммы и все, что вы использовали раньше; Зашифровать ячейки с паролем; Создать список рассылки и отправлять электронные письма …
  • Бар Супер Формулы (легко редактировать несколько строк текста и формул); Макет для чтения (легко читать и редактировать большое количество ячеек); Вставить в отфильтрованный диапазон
  • Объединить ячейки / строки / столбцы без потери данных; Разделить содержимое ячеек; Объединить повторяющиеся строки / столбцы… Предотвращение дублирования ячеек; Сравнить диапазоны
  • Выберите Дубликат или Уникальный Ряды; Выбрать пустые строки (все ячейки пустые); Супер находка и нечеткая находка во многих рабочих тетрадях; Случайный выбор …
  • Точная копия Несколько ячеек без изменения ссылки на формулу; Автоматическое создание ссылок на несколько листов; Вставить пули, Флажки и многое другое …
  • Извлечь текст, Добавить текст, Удалить по позиции, Удалить пробел; Создание и печать промежуточных итогов по страницам; Преобразование содержимого ячеек в комментарии
  • Суперфильтр (сохранять и применять схемы фильтров к другим листам); Расширенная сортировка по месяцам / неделям / дням, периодичности и др .; Специальный фильтр жирным, курсивом …
  • Комбинируйте книги и рабочие листы; Объединить таблицы на основе ключевых столбцов; Разделить данные на несколько листов; Пакетное преобразование xls, xlsx и PDF
  • Более 300 мощных функций. Поддерживает Office/Excel 2007-2021 и 365. Поддерживает все языки. Простое развертывание на вашем предприятии или в организации. Полнофункциональная 30-дневная бесплатная пробная версия. 60-дневная гарантия возврата денег.

вкладка kte 201905


Вкладка Office: интерфейс с вкладками в Office и упрощение работы

  • Включение редактирования и чтения с вкладками в Word, Excel, PowerPoint, Издатель, доступ, Visio и проект.
  • Открывайте и создавайте несколько документов на новых вкладках одного окна, а не в новых окнах.
  • Повышает вашу продуктивность на 50% и сокращает количество щелчков мышью на сотни каждый день!

офисный дно

Комментарии (0)


Оценок пока нет. Оцените первым!

Excel’s number formatting doesn’t support file sizes by default. However, it allows you to program your own formatting style. In this guide, we’re going to show you how to format numbers as file sizes in Excel.

Download Workbook

The number formatting is one the most useful features of Excel. Essentially, you can customize how a number in a cell be displayed. Currency signs and thousand-decimal delimiters are popular examples. Along with default number formatting types like currency, date, or ZIP code, you can create your own custom formatting, or even tie them to conditions. For the purposes of this tutorial, we are going to be using a condition to show the correct unit for the corresponding size like 1KB for 1000, 1MB for 1000000, etc.

Example

Let’s see how this works on an example.

  1. Select the cell(s) you want to apply a number formatting.
  2. Press Ctrl + 1 or right-click and select Format Cells.
  3. Make sure the Number tab is selected.
  4. Select Custom for Category.
  5. Enter a custom format into Type [<1000]##0.00″ B»;[<1000000]##0.00,» KB»;##0.00,,» MB»
  6. Click OK to apply.
    How to format numbers as file sizes in Excel 01

Number formatting only supports byte (B), kilobyte (KB), and megabyte (MB) units. However, further options like GB, TB or PB are left out (There is a three condition limit in Excel). Let’s see what the code means.

[<1000]##0.00″ B»;[<1000000]##0.00,» KB»;##0.00,,» MB»

This number formatting code tells Excel to display numbers less than 1000 with 2 decimals and a “B” character at the end. The rule also states that numbers between 1000 and 1000000 to round to 1000 and finish with “KB”. The numbers greater than 1000000 get “MB”. Each condition is separated by a semi colon character (;).

Due to the three-condition limitation, you need to choose 3 file size units that fit your data. Alternatively, you can overcome this limitation by using conditional formatting.

Using conditional formatting to format numbers as file sizes

Thanks to the conditional formatting feature, you can change the number format of a cell based on its value. Thus, you can use a different custom number formatting which includes GB, TB and PB if the cell value is greater than 1,000,000,000.

[<1000000000000]##0.00,,,» GB»;[<1000000000000000]##0.00,,,,» TB»;#,##0.00,,,,,» PB»

Follow the steps to add a conditional formatting to format numbers as file sizes.

  1. Select the cells.
  2. Click Home > Conditional Formatting > New Rule in the Ribbon
  3. Select Format only cells that contain in Rule Type window
  4. Select greater than or equal to and enter 1000000000
  5. Click Format to open Format Cells window
  6. Enter the code for the numbers which match the condition
  7. Click OK buttons to apply

My goto formula for this after many years of refinement is the here.

You can use the beginning variable definitions to define aspects of the conversion:

  • cell defines the cell containing the bytes to format
  • cell_style defines if you’re using the R1C1 (rowcolumn) or the A1 (alphanumeric) cell reference style
  • unit_type defines if you want the resulting output calculated to a binary or metric value
=LET(

README_,"This formula formats a byte count, rounding it to its significant digit and to two decimal places, applying the appropriate unit of measurement",

README1,"Adjust the below [variable] definitions to your need, where the viable options are (bracketed)",
README2,"[cell]       specify the individual cell address containing the byte count to format, this should be contained within double quotation marks",
README3,"[cell_style] define if you're using the R1C1 (rowcolumn) or the A1 (alphanumeric) cell reference style",
README4,"[unit_type]  define if you want the resulting output calculated to a base 2 (binary) or base 10 (metric) value",

CONSTANTS,"Do not alter these",
binary,1024,
metric,1000,
rowcolumn,0,
alphanumeric,1,

VARIABLES,"Adjust these to your need",
cell,"RC[-1]",
unit_type,binary,
cell_style,rowcolumn,

IF(N("Error if the speficied cell is not a number")+
NOT(ISNUMBER(INDIRECT(cell,cell_style))),"#MISSINGNO",

IF(unit_type=1000
+N("Calculate the result at base 10"),

IF((INDIRECT(cell,cell_style)>=1000^8),
TEXT((INDIRECT(cell,cell_style)/1000/1000/1000/1000/1000/1000/1000/1000),"#,## ????.00 YB"),
IF((INDIRECT(cell,cell_style)>=1000^7),
TEXT((INDIRECT(cell,cell_style)/1000/1000/1000/1000/1000/1000/1000),"#,## ????.00 ZB"),
IF((INDIRECT(cell,cell_style)>=1000^6),
TEXT((INDIRECT(cell,cell_style)/1000/1000/1000/1000/1000/1000),"#,## ????.00 EB"),
IF((INDIRECT(cell,cell_style)>=1000^5),
TEXT((INDIRECT(cell,cell_style)/1000/1000/1000/1000/1000),"#,## ????.00 PB"),
IF((INDIRECT(cell,cell_style)>=1000^4),
TEXT((INDIRECT(cell,cell_style)/1000/1000/1000/1000),"#,## ????.00 TB"),
IF((INDIRECT(cell,cell_style)>=1000^3),
TEXT((INDIRECT(cell,cell_style)/1000/1000/1000),"#,## ????.00 GB"),
IF((INDIRECT(cell,cell_style)>=1000^2),
TEXT((INDIRECT(cell,cell_style)/1000/1000),"#,## ????.00 MB"),
IF((INDIRECT(cell,cell_style)>=1000^1),
TEXT((INDIRECT(cell,cell_style)/1000),"#,## ????.00 KB"),
IF(INDIRECT(cell,cell_style)=1,
"1 B",TEXT(INDIRECT(cell,cell_style),"## ????0 B")
))))))))),

IF(unit_type=1024
+N("Calculate the result at base 2"),

IF((INDIRECT(cell,cell_style)>=POWER(2,80)),
TEXT((INDIRECT(cell,cell_style)/POWER(2,80)),"#,## ????.00 YiB"),
IF((INDIRECT(cell,cell_style)>=POWER(2,70)),
TEXT((INDIRECT(cell,cell_style)/POWER(2,70)),"#,## ????.00 ZiB"),
IF((INDIRECT(cell,cell_style)>=POWER(2,60)),
TEXT((INDIRECT(cell,cell_style)/POWER(2,60)),"#,## ????.00 EiB"),
IF((INDIRECT(cell,cell_style)>=POWER(2,50)),
TEXT((INDIRECT(cell,cell_style)/POWER(2,50)),"#,## ????.00 PiB"),
IF((INDIRECT(cell,cell_style)>=POWER(2,40)),
TEXT((INDIRECT(cell,cell_style)/POWER(2,40)),"#,## ????.00 TiB"),
IF((INDIRECT(cell,cell_style)>=POWER(2,30)),
TEXT((INDIRECT(cell,cell_style)/POWER(2,30)),"#,## ????.00 GiB"),
IF((INDIRECT(cell,cell_style)>=POWER(2,20)),
TEXT((INDIRECT(cell,cell_style)/POWER(2,20)),"#,## ????.00 MiB"),
IF((INDIRECT(cell,cell_style)>=1024),
TEXT((INDIRECT(cell,cell_style)/1024),"#,## ????.00 KiB"),
IF(INDIRECT(cell,cell_style)=1,
"1 B",TEXT(INDIRECT(cell,cell_style),"## ????0 B")
)))))))))))))

If you ever want to do the reverse, and derive a rough raw count of bytes from a pre-formatted value, I’ve got a formula for that too.

I will gladly share a beer with Abe Gold. Or if you all could get me reputation where I can comment on Abe Gold’s entry, that would be great too.

Here’s the solution that worked for me, building from Abe’s. It uses standard US formatting (changed semicolons to commas) and just returns the value of the cell being evaluated if (gb,mb,kb,b) are not found. (paste this text to A2, then copy to wherever you need it for further updates):

=IFERROR(VALUE(IFERROR(LEFT(A1,FIND(" ",A1)),A1))/IF(ISERROR(SEARCH("gb",A1)), IF(ISERROR(SEARCH("mb",A1)),IF(ISERROR(SEARCH("kb",A1)), 1073741824, 1048576), 1024), 1),A1)

If you have Office 2019/Office365, you can use this:

=IFERROR(VALUE(IFERROR(LEFT(A1,FIND(" ",A1)),A1))/IFS(ISERROR(SEARCH("gb",A1)),1,ISERROR(SEARCH("mb",A1)),1024,ISERROR(SEARCH("kb",A1)),1048576,ISERROR(SEARCH("b",A1)),1073741824),A1)

Понравилась статья? Поделить с друзьями:
  • Excel часть строки от символа до символа
  • Excel часть строки до пробела
  • Excel часть строки в формуле excel
  • Excel часть от целого
  • Excel часто используемые данные