Get Pipe Diameter from Code
As a plumbing contractor, I frequently work with part codes that embed the pipe diameter at the end, such as 'COPPER-PIPE-15' where '15' is the diameter. I need a quick way to extract these last two digits into a separate column for inventory management and material ordering.
=RIGHT(A2, 2) How it works: The RIGHT function extracts a specified number of characters from the end of a text string. In this formula, `A2` refers to the cell containing the part code (e.g., 'COPPER-PIPE-15'), and `2` specifies that we want to extract the last two characters from that string. This effectively isolates the diameter size from the end of the part code.
Data Setup
| Part Code | Description |
|---|---|
| COPPER-PIPE-15 | Standard Copper Pipe |
| PVC-DRAIN-50 | PVC Drain Pipe |
| GALV-FITTING-25 | Galvanized Fitting |
| PEX-TUBING-20 | PEX Tubing |
Step-by-Step Guide
Open your Excel spreadsheet containing the part codes.
Select the cell where you want the extracted diameter to appear for the first part code (e.g., cell C2, assuming part codes are in column A starting from A2).
Type the formula `=RIGHT(A2, 2)` into the selected cell.
Press Enter. The diameter '15' will appear in cell C2.
Click on cell C2 again, then drag the fill handle (the small square at the bottom-right corner of the cell) down to apply the formula to all other part codes in your list.