Function Problems

How to Extract Fuel Type and Amount from Text Strings in Excel

Anum MushtaqAnum Mushtaq Nov 11, 2026 869 views

Question details

Extract specific fuel type codes and their corresponding fuel amounts from a longer expense description string.

How to Extract Fuel Type and Amount from Text Strings in Excel
Product
Excel
Device & OS
not provided
Scenario
Parsing mixed text and numbers within single cells from expense logs to organize fuel data into separate columns.
Observed behavior
The fuel type (e.g., DSL, UNL) and amount with units (e.g., 63.74L, 19.173GAL) are embedded in a continuous text string, requiring extraction formulas to isolate them.
Before you start

Ensure your expense description data is organized in a consistent column, and note that the formulas for extracting the amount require a modern version of Excel that supports dynamic array functions like TEXTSPLIT and TAKE.

Solution 1Recommended

Extract the Fuel Type Using IFS and SEARCH

Use logical and text search functions to look for specific keywords in the cell and return the exact match.

The SEARCH function looks for the position of specific strings like "DSL" or "UNL". Wrapping it in ISNUMBER and IFS allows Excel to return the matched string cleanly when found.

1
Select the target cell

Click on an empty cell next to your expense description (e.g., cell B2) where you want the fuel type to appear.

2
Enter the IFS and SEARCH formula

Type the following formula into the formula bar: =IFS(ISNUMBER(SEARCH("DSL",A2)),"DSL",ISNUMBER(SEARCH("UNL",A2)),"UNL",TRUE,"")

3
Apply to the rest of your data

Press Enter to execute the formula, then drag the fill handle down to apply this extraction logic to the rest of the rows in your column.

Extract the Fuel Type Using IFS and SEARCH
Case Insensitivity: The SEARCH function is case-insensitive, meaning it will successfully catch variations like "dsl", "Dsl", or "DSL".
Powerful Data Processing

Extract Text and Numbers Easily in WPS Spreadsheet

WPS Spreadsheet provides comprehensive support for logical and text functions like IFS, SEARCH, and SUBSTITUTE. Easily parse complex strings, expense descriptions, and messy logs without needing advanced programming skills.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the file containing your expense descriptions.
  2. 2. Select the target cell: Click the cell where you want to output the extracted fuel type or amount.
  3. 3. Input your extraction formula: Type your chosen formula (like =IFS(ISNUMBER(SEARCH...)) directly into the formula bar at the top.
  4. 4. Fill down the column: Press Enter, then double-click the small green square at the bottom-right of the cell to auto-fill the formula down the entire column.
Fully compatible with Microsoft Excel (.xlsx, .xls, .csv) formats.Supports advanced logical and text manipulation formulas to easily extract fuel types and amounts.Lightweight software with a familiar, easy-to-use tabbed interface.Free built-in data processing and visualization tools.
microsoft office alternative - wps office

Frequently Asked Questions

What if my version of Excel doesn't support the TEXTSPLIT function?

If you are using an older version of Excel, functions like TEXTSPLIT and TAKE will not work. Instead, you can use a combination of LEFT, RIGHT, MID, and FIND functions to manually locate the spaces in the string and extract the desired text segment.

How can I sum up the fuel amounts once they are extracted?

To perform calculations, the data must be formatted as numbers, not text. Use the third solution provided, which utilizes the VALUE and SUBSTITUTE functions to remove text units like "L" or "GAL" and convert the remaining string into a pure, calculable number. You can then use the SUM function on that column.

Will the IFS formula work if I need to add more fuel types later?

Yes, the IFS function is highly scalable. You can continually add pairs of conditions and results to the formula. For example, to add an "E85" fuel type, simply insert ISNUMBER(SEARCH("E85",A2)),"E85" into the existing IFS structure before the TRUE condition.