Google Sheets MIDB Function

This post will guide you how to use Google Sheets MIDB function with syntax and examples.

Description


The Google Sheets MIDB function returns a substring (a specified number of bytes) starting from the middle of a text string and up to a specified number of bytes.

The MIDB function can be used to extract a given bytes of characters from the middle of a text string in google sheets. It returns a substring from a text string at the position that you specify.

The MIDB function is a build-in function in Google Sheets and it is categorized as a Text Function.

Syntax


The syntax of the MIDB function is as below:

= MIDB (text, start_num, length_bytes)

Where the MIDB function arguments are:

  • text -This is a required argument. The text string that you want to extract substring from.
  • start_num-This is a required argument.  The position of the first character that you want to extract in text string. The index from the left of text string from which to begin extracting. And the first character in text string is the index 1.
  • length_bytes-This is a required argument.  The number of the bytes that you want to extract from a text string.

Note: 

  • If start_num is greater than the length of text, the MIDB function will return empty text.
  • If start_num is less than 1, the MIDB function will return the #VALUE! Error value.
  • If Length_bytesis negative, MIDB will return the #VALUE!  Error value.
  • If you want to extract a substring from start_num to the end of text string, and you can use the LEN function to calculate the length of the text string, you should not specify a large number to length_bytes argument for this case.
  • If you want to extract a substring beginning with a particular character, and you should use the SEARCH function to get the index of  that character in text string.
  • Length_bytes must be greater than or equal to 0.
  • Start_num must be greater than or equal to 1.
  • If text string has only single bytes characters and the MIDB function returns the same value as MID function.

Google Sheets MIDB Function Examples


The below examples will show you how to use google sheets MIDB Text function to extract a substring from a text string.

#1 To extract 10 bytes of substring  from the text string in B1, starting at the 5th character, just using the following formula:

=MIDB(B1,5,10)  //it returns “le sheets”

google sheets midb function1

#2 If num_chars value is greater than the length of remaining bytes, and the MID function will return all remining characters:

=MIDB("google",3,200) //it returns “ogle”

google sheets midb function1

#3 if text value is a number, and the returned value is also a text by MID function:

=MIDB(1234,2,2)   //it returns “23”

google sheets midb function1

 

Note:

You can use the LEFTB function to extract substring from the left side of a text string in Google Sheets. And you can also use another function called RIGHTB function to extract a substring starting from the right side of the text string. And if you wish to extract a substring starting from the middle position of text string, you can use the MIDB function in google sheets.

Related Functions


  • Google Sheets LEFT Function
    The Google Sheets LEFT function returns a substring (a specified number of the characters) from a text string, starting from the leftmost character.The syntax of the LEFT function is as below:= LEFT(text,[num_chars])…
  • Google Sheets LEN Function
    The Google Sheets LEN function returns the length of a text string (the number of characters in a text string).The syntax of the LEN function is as below:= LEN(text)…

 

 

 

 

Related Posts

Google Sheets WORKDAY.INTL Function
google sheets workday.intl function1

This post will guide you how to use Google Sheets WORKDAY.INTL function with syntax and examples. Description The Google Sheets WORKDAY.INTL function returns the serial number of the date before or after a specified number of workdays. And this function ...

Google Sheets WORKDAY Function
google sheets workday function1

This post will guide you how to use Google Sheets WORKDAY function with syntax and examples. Description The Google Sheets WORKDAY function returns a date or a serial number that represents a date that is the indicated number of working ...

Google Sheets WEEKNUM Function
google sheet weeknum function1

This post will guide you how to use Google Sheets WEEKNUM function with syntax and examples. Description The Google Sheets WEEKNUM function returns the week number of a specific date, and the returned value is ranging from 1 to 53. ...

Google Sheets WEEKDAY Function
google sheet weekday function1

This post will guide you how to use Google Sheets WEEKDAY function with syntax and examples. Description The Google Sheets WEEKDAY function returns an integer value representing the day of the week for a given date and the value is ...

Google Sheets TIMEVALUE Function
google sheets timevalue function1

This post will guide you how to use Google Sheets TIMEVALUE function with syntax and examples. Description The Google Sheets TIMEVALUE returns the decimal number of the time represented by a text string. It will convert a time represented by ...

Google Sheets TODAY Function
google sheets today function

This post will guide you how to use Google Sheets TODAY function with syntax and examples. Description The Google Sheets TODAY function get the current date as a date value. And it will be updated each time when your worksheet ...

Google Sheets TIME Function
google sheets time function1

This post will guide you how to use Google Sheets TIME function with syntax and examples. Description The Google Sheets TIME function converts an hour, minute and second into a time. The TIME function can be used to create a ...

Google Sheets SECOND Function
google sheets second function1

This post will guide you how to use Google Sheets SECOND function with syntax and examples. Description The Google Sheets SECOND function returns the seconds of a time value. Or returns an integer value that represent the second component of ...

Google Sheets NOW Function
google sheets now function1

This post will guide you how to use Google Sheets NOW function with syntax and examples. Description The Google Sheets NOW function returns the serial number of the current date and time. And it will be updated each time when ...

Google Sheets NETWORKDAYS.INTL Function
google sheets networkdays.intl function1

This post will guide you how to use Google Sheets NETWORKDAYS.INTL function with syntax and examples. Description The Google Sheets NETWORKDAYS.INTL function returns the number of net working days between tow given days excluding specified weekend days and holidays. The ...

Sidebar