Function Problems

How to Automatically Return a Yarn Color from a Temperature in Excel

Steven ParkerSteven Parker Nov 3, 2026 869 views

Question details

The user wants to automatically retrieve and display specific yarn color names based on daily temperature records in Excel.

How to Automatically Return a Yarn Color from a Temperature in Excel
Product
Excel
Device & OS
not provided
Scenario
Creating a temperature blanket or crochet project tracking spreadsheet where daily temperature inputs automatically output the designated yarn color name via a lookup formula.
Observed behavior
Instead of relying solely on cell background colors via conditional formatting, the goal is to extract the exact text of the yarn color by mapping a temperature to a defined range table.
Before you start

Create a reference table with your temperature ranges (lower bounds) in one column and the corresponding yarn color names in the adjacent column, ensuring the temperatures are sorted from lowest to highest.

Solution 1Recommended

Use VLOOKUP with an Approximate Match

Use the VLOOKUP function set to TRUE to automatically match a given temperature to the correct range tier and return the corresponding yarn color.

VLOOKUP is ideal for mapping continuous numerical values (like temperatures) to specific categories. By setting the match type to TRUE (approximate match), Excel finds the next largest value that is less than or equal to your recorded temperature.

1
Create the Reference Table

In columns D and E, set up your lookup table. Enter the lower bound of each temperature range in column D (e.g., 0, 30, 40, 50) and the corresponding yarn color in column E (e.g., Blue, Teal, Green, Yellow). Sort column D from lowest to highest.

2
Enter the VLOOKUP Formula

Click the cell where you want the color name to appear (e.g., B2). Type the formula: =VLOOKUP(A2, D2:E10, 2, TRUE), assuming A2 contains your daily temperature.

3
Lock the Reference Table Using F4

Before hitting Enter, highlight the D2:E10 part of your formula and press the F4 key on your keyboard. This changes it to $D$2:$E$10, making it an absolute reference. This crucial step prevents the table range from shifting when you copy the formula down.

4
Apply to the Rest of the Column

Press Enter to execute the formula, then click and drag the fill handle at the bottom right of cell B2 down the column to apply it to all your recorded temperatures.

Use VLOOKUP with an Approximate Match
Reference Locking: Pressing F4 to lock your lookup table array is essential. Without absolute references, your formula will return #N/A errors as you drag it down.
Track Crafting Projects Easily

Manage Your Temperature Blanket Data in WPS Spreadsheet

WPS Spreadsheet provides robust support for advanced data functions including VLOOKUP, XLOOKUP, and INDEX/MATCH. You can easily automate your yarn color assignments and track your daily temperatures in a free, lightweight interface.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and create a new blank spreadsheet for your project.
  2. 2. Enter Temperature Tiers: Set up your reference table with temperature thresholds and corresponding yarn colors.
  3. 3. Record Daily Temperatures: Input your daily recorded temperatures into a dedicated column.
  4. 4. Apply the Lookup Formula: Use =VLOOKUP() or =XLOOKUP() and press F4 to lock the reference table, automatically assigning colors to your daily records.
100% compatible with Microsoft Excel formulas and .xlsx filesFully supports VLOOKUP, XLOOKUP, and absolute cell references (F4)Built-in conditional formatting to colorize cells automaticallyFree to download and use for all your personal crafting projects
microsoft office alternative - wps office

Frequently Asked Questions

Why does my VLOOKUP formula return #N/A when I drag it down?

This happens when the lookup table range shifts down along with your formula. To fix this, you must use absolute references for the table array by selecting the range in the formula bar and pressing the F4 key (e.g., changing D2:E10 to $D$2:$E$10).

Does my reference table need to be in a specific order?

Yes. If you are using VLOOKUP with TRUE (approximate match), the temperature column in your lookup table must be sorted in ascending order (lowest to highest) for the formula to return the correct yarn color.

Can I automatically change the cell background color to match the yarn?

Yes. While the formula returns the text name of the color, you can use Conditional Formatting rules (e.g., 'Format only cells that contain' -> 'Specific Text') to automatically fill the cell background with the actual visual color based on the text returned by your VLOOKUP formula.