Contact

MIDB in WPS Spreadsheet: Extract an Interior Segment by Byte Position

Text Intermediate WPS Spreadsheet

Use MIDB with one-based positions and whole-character lengths in WPS’s documented Chinese/Latin context, including numeric-text preservation.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: =MIDB("AB春风CD",3,4) is expected to return 春风 under the documented Chinese double-byte convention. The start is one-based and the requested length is four count units.

Syntax and position map

=MIDB(text,start_num,num_bytes)

All three arguments are supplied in these examples. Text is the source, start_num identifies the beginning of the desired segment, and num_bytes specifies its length. The official walkthrough counts three Chinese characters as six units and begins an ASCII numeric field at position seven.

For the original example AB春风CD:

Character Count positions
A 1
B 2
春 3–4
风 5–6
C 7
D 8

Starting at 3 and taking four units includes 春 and 风. Starting at 5 and taking three units includes 风 and C.

Complete worksheet example

Enter AB春风CD as text in A2. In B2 enter =MIDB(A2,3,4); the independent expected output is 春风.

Additional checks on the same input are:

  • =MIDB("AB春风CD",5,3) → 风C.
  • =MIDB("AB春风CD",7,2) → CD.

Every start and endpoint lies at a whole-character boundary. Start 5 is the first count position of 风, not the fifth visible character. The fifth visible character is C, at count position 7.

For a second dataset, enter 春风0075 in A3. =MIDB(A3,5,4) is expected to return 0075 as text. The two Chinese characters consume four count units; the four ASCII digits follow. Keeping the result as text preserves its leading zeros.

Advanced use: split a controlled mixed-width record

A record format may define a two-character Chinese label followed by a four-digit code. The formula with start 5 and length 4 extracts that code under the stated convention. An independent audit is to write down the component widths: 2+2 for the label, then 1+1+1+1 for the code.

The formula does not validate that every record has that structure. A missing label character or an inserted space shifts the code. Keep the source column and check the layout before treating the extracted text as an identifier. Do not convert the code to a number if 0075 and 75 are distinct labels in the source system.

For variable-length fields, a fixed start is insufficient. A separate position-finding step may help, but its returned positions must use the same counting convention as MIDB. Mixing a character-counted position with a byte-counted extraction can cut the wrong segment.

Documented error and unverified boundaries

WPS explicitly states that a negative num_bytes returns #VALUE!. Thus =MIDB("AB",1,-1) has that documentation-based error expectation; it has not been executed here.

The cited lesson does not give a complete table for invalid starts, overrun lengths, fractional arguments, blank cells or half-character cuts. These examples do not assign results to those cases. A start inside a two-count Chinese character is deliberately excluded rather than guessed from another spreadsheet’s behavior.

Counting scope and safe boundaries

These examples use the historical lesson’s Chinese double-byte context: the ordinary Chinese characters shown count as 2, and Latin ASCII letters and digits count as 1. This is a spreadsheet counting convention for the documented context, not a universal UTF-8 byte-length rule. No result is inferred for emoji, supplementary characters, combining marks or every language/locale configuration.

All worked cuts land on complete-character boundaries. A position or length that cuts through one of the two-count Chinese characters is outside these examples; the lesson does not establish a reliable result for that case here. Do not invent a space, replacement character or partial encoded byte as the expected output.

Use the same counting system for positions and lengths. Character positions from a different function are not automatically compatible with byte-counted positions. Confirm the actual client and input convention before applying these formulas to an imported file.

Evidence and version scope

The official WPS Academy MIDB lesson, published 2019-05-29, explicitly applies to WPS Office for Windows Personal. It was reviewed on October 18, 2026. The numeric build, introduction release and last supported version remain unknown. The source does not identify this function as deprecated or retired. Support in Linux, other editions and other platforms is not established by this lesson.

The worked examples are original mathematical expectations based on the official contract and formula illustration. They were not executed in WPS. Historical vendor demonstrations are documentation, not our application tests; no screenshot or runtime precision guarantee is supplied. English names and comma separators follow the lesson. Localized entry, workbook interchange and exact output formatting require verification in the intended client.

  • MID: extract using character positions.
  • FINDB: locate a string using compatible documented byte positions.
  • LEFTB: extract from the beginning.