AutomateExcel Logo

Return to Excel Formulas List

Assign Number Value to Text – Excel & Google Sheets

Download the example workbook

This tutorial will demonstrate how to assign a numerical value to a text string.

assign number value to text Main

VLOOKUP Method

To assign a number value to a text string, we can use the VLOOKUP Function along with our lookup table. In this example, we assign a SKU number to each product like so:

VLOOKUP

This formula finds “Chair” in the range E3:F5 and returns the second column in that row: “2235”. (The “0” argument specifies that we need an exact match.)

XLOOKUP Method

Another method is to use the XLOOKUP Function to achieve the same results:

XLOOKUP

Instead of a range and column index number, the XLOOKUP Function takes a lookup array and a return array.

Locking Cell References

To make our formulas easier to read, we’ve shown the formulas without locked cell references:

But these formulas will not work properly when copy and pasted elsewhere within your Excel file. Instead, you should use locked cell references like this:

Read our article on Locking Cell References to learn more.

Assign Number Value to Text in Google Sheets

The examples shown above work the same way in Google Sheets as they do in Excel.

assign number value to text Google

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

Free Download

assign value to text in excel

ExcelDemy

How to Assign Value If Cell Contains Word in Excel (4 Easy Ways)

Chinmoy Mondol

If you want to assign a value to a cell based on a certain word in another cell, then you’ll need to build a formula because Excel doesn’t provide a simple way of doing so. The following article will help you in this regard. In this article, I will show you how to assign a value if a cell contains a word in Excel.

Download Practice Workbook

You can download the free Excel workbook here and practice on your own.

4 Easy Ways to Assign Value If Cell Contains Word in Excel

In this article, you will see four easy ways to assign a value if a cell contains a word in Excel. To apply these methods, I will need some Excel functions. You will see the use of IF , COUNTIF , ISNUMBER , SEARCH , FIND , VLOOKUP , and IFERROR functions in the following procedures. Aside from applying formulas to show the result, I will also show the breakdown of those formulas in their relevant section.

To illustrate my further procedure, I will use the following sample data sets where I have two types of beverages.

4 Easy Ways to Assign Value If Cell Contains Word in Excel

1. Combine IF and COUNTIF Functions

In the first procedure, I will use the combination of IF and COUNTIF functions to assign a value based on a specific input criterion. Go through the following steps for a better understanding.

assign value to text in excel

Combine IF and COUNTIF Functions as An Easy Way to Assign Value If Cell Contains Word in Excel

Formula Breakdown

=IF(COUNTIF($B7,”*”&$C$4&”*”), B7, “Not Found”)

assign value to text in excel

Read More: If Cell Contains Text Then Add Text in Another Cell in Excel

2. Merge IF, ISNUMBER, and SEARCH Functions

In the second method, I will repeat the same action as in the previous one but with a different formula and combination. This time I will combine the IF , ISNUMBER , and SEARCH functions in a single formula to get my job done. Follow the following steps for a better understanding.

assign value to text in excel

=IF(ISNUMBER(SEARCH($C$4,$B7)),B7,”Not Found”)

assign value to text in excel

Read More: Excel If Cell Contains Text Then Return Value (8 Easy Ways)

Similar Readings

3. Combine IF, ISNUMBER with FIND Function

This time, you will see the use of the FIND function in the combination of IF and ISNUMBER functions as the third procedure. By using this combination, I will check whether a specific input criterion matches the assigned cell values or not. To find the details of this procedure, see the following steps.

assign value to text in excel

=IF(ISNUMBER(FIND($C$4,$B7)), B7, “Not Found”)

assign value to text in excel

Read More: How to Return Value If Cells Contain Certain Text from a List

4. Insert VLOOKUP Function into IF and IFERROR Functions

In the last method of this procedure, I will insert the VLOOKUP function in the combination formula of the IFERROR and IF functions. This formula also works like the rest of the methods, but with some extra features under its sleeve. Here, I will use the VLOOKUP function for Approximate Match (True), which will return the value even if it is not an exact match. You will see the detailed procedure in the following steps.

Insert VLOOKUP Function into IF and IFERROR Functions as An Easy Way to Assign Value If Cell Contains Word in Excel

=IFERROR(IF(VLOOKUP($C$4,$B7,1,TRUE)=”Chips”, B7, B7),”Not Found”)

assign value to text in excel

Read More: How to Use VLOOKUP If Cell Contains a Word within Text in Excel

Things to Remember

That’s the end of this article. I hope you find this article helpful. After reading the above description, you can assign a value if a cell contains a word in Excel. Please share any further queries or recommendations with us in the comments section below.

The ExcelDemy team is always concerned about your preferences. Therefore, after commenting, please give us some moments to solve your issues, and we will reply to your queries with the best possible solutions.

Related Articles

Tags: COUNTIF Function Excel If Cell Contains Text FIND Function IF Function IFERROR Function ISNUMBER Function SEARCH Function VLOOKUP Function

Chinmoy Mondol

Chinmoy Mondol

Greetings! Thank you for visiting my profile. I am Chinmoy Mondol. I am a conscientious, tech enthusiast individual with a voracious appetite for knowledge and a desire to learn more. I graduated from American International University-Bangladesh with a Bachelor's Degree in Computer Science and Engineering. I enjoy using my skills to contribute to the exciting technological advances that happen every day. Constant advancement and personal development are my guiding principles.

cubic spline interpolation excel

How to Apply Cubic Spline Interpolation in Excel (with Easy Steps)

Adding Prefix using Custom format

How to Add Text Prefix with Custom Format in Excel (4 Examples)

material reconciliation format in excel

How to Create Material Reconciliation Format in Excel

Excel VLOOKUP function exact match

How to Use VLOOKUP Function with Exact Match in Excel

' src=

Thank you so much on the Using the COUNTIF function! Can’t get easier to me.

Leave a reply Cancel reply

ExcelDemy is a place where you can learn Excel, and get solutions to your Excel & Excel VBA-related problems, Data Analysis with Excel, etc. We provide tips, how to guide, provide online training, and also provide Excel solutions to your business problems.

Contact  |  Privacy Policy  |  TOS

ExcelDemy.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program. I earn a small commission if you buy any products using my affiliate links to Amazon.

DMCA.com Protection Status

Stack Exchange Network

Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How do I assign a number value to a non-numerical value in Excel

I have some survey responses with values like "VU" for "Very Unlikely" and "S" for Sometimes. Each survey response occupies a cell. For each cell containing a survey response, I want to fill another cell with a corresponding number. For example, for every cell containing "VU" I want to fill a corresponding cell with the number 1.

How is this done?

Hennes's user avatar

3 Answers 3

I would have a seperate table in another tab that details the values:

Then, in a new column, on the survey I would add this formula:

where A2 refers to the respondents answer for that row and Codesheet refers to the sheet where you put the above value table.

Now you should be able to sort by the new column.

Sux2Lose's user avatar

You can easily do this with a formula. Something like:

Where A1 is the cell containing the response.

I used Very Unlikely, Sometimes, Likely, Very Likely as possible responses.

It would also be possible to create a VBA macro to do this, but i think that would be complicating it...

AkkA's user avatar

I wound up settling on a good old-fashioned array look-up like this:

However, in some cells, the cell reference that is the LOOKUP's first argument pointed to an empty cell resulting in an "N/A" error. My response to this was to apply the NOT() and ISBLANK() functions like so:

Not the answer you're looking for? Browse other questions tagged microsoft-excel or ask your own question .

Hot Network Questions

assign value to text in excel

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

How to convert numbers to text using Excel TEXT function and other options

Maria Azbel

This tutorial shows how to convert number to text in Excel 2016, 2013 and 2010. See how to accomplish the task with the Excel TEXT function and use number to string to specify the formatting. Learn how to change number format to text with the Format Cells… and Text to Columns options.

If you use Excel spreadsheets to store long and not so long numbers, one day you may need to convert them to text. There may be different reasons to change digits stored as numbers to text. Below you'll find why you may need to make Excel see the entered digits as text, not as number.

Matching 2 identical cells with different formats Excel ignores

The same issue can occur if the cells are formatted as ZIP code, SSN, telephone number, currency, etc.

In this article I'll show you how to convert numbers to text with the help of the Excel TEXT function. If you are not so formula-oriented, have a look at the part where I explain how to change digits to text format with the help of the standard Excel Format Cells window, by adding an apostrophe and employing the Text to Columns wizard.

convert-number-to-text-excel-TEXT-function

Convert number to text using the Excel TEXT function

Use the format cells option to convert number to text in excel, add an apostrophe to change number to text format, convert numbers to text in excel with text to columns wizard.

The most powerful and flexible way to convert numbers to text is using the TEXT function. It turns a numeric value into text and allows to specify the way this value will be displayed. It's helpful when you need to show numbers in a more readable format, or if you want to join digits with text or symbols. The TEXT function converts a numeric value to formatted text, thus the result cannot be calculated.

If you are familiar with using formulas in Excel, it will not be a problem for you to employ the TEXT function.

Copy the formula across the column using the fill handle

Select the Values radio button on the Paste Special dialog box

Now you can either rename the helper column and delete the original one, or copy the results to your main and remove the temporary column.

Note. The second parameter in the Excel TEXT function shows how the number will be formatted before being converted. You may need to adjust this based on your numbers:

The result of =TEXT(123.25,"0") will be 123.

The result of =TEXT(123.25,"0.0") will be 123.3.

The result of =TEXT(123.25,"0.00") will be 123.25.

If you need to quickly change the number to string, do it with the Format Cells… option.

Pick the Format Cells… option from the menu list

You'll see the alignment change to left, so the format will change to text. This option is good if you don't need to adjust the way your numbers will be formatted.

If these are just 2 or 3 cells in Excel where you want to convert numbers to string, benefit from adding an apostrophe before the number. This will instantly change the number format to text.

Add an apostrophe to convert number to test

You will see a small triangle added in the corner of this cell. This is not the best way to convert numbers to text in bulk, but it's the fastest one if you need to change just 2 or 3 cells.

You may be surprised but the Excel Text to Columns option is quite good at converting numbers to text. Just follow the steps below to see how it works.

Navigate to the Data tab in Excel and click on the Text to Columns icon

I hope the tips and tricks from this article will help you in your work with numeric values in Excel. Convert number to string using the Excel TEXT function to adjust the way your numbers will be displayed, or use Format Cells and Text to Columns for quick conversions in bulk. If these are just several cells, add an apostrophe. Feel free to leave your comments if you have anything to add or ask. Be happy and excel in Excel!

You may also be interested in

Table of contents

Ablebits.com website logo

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Assign a value for a text cell

is it possible to assign a value for a cell that contains text?

To illustrate a lit bit let´s suppose that Barcelona has 8 Titles, Real Madrid 8, Bayern Munchen 5, Arsenal 7

So every time I see a cell that contains "Barcelona" it is equal to 8 and "Arsenal" equals to 7. Meaning that if sum the cell containing "Barcelona" and "Arsenal", the output will be 15. Is it possible to make something like this without having to use another table with those established values?

Thank you!!!

Bruno Tavares's user avatar

The following will work, but you have to type it out every time:

enter image description here

Now you'll be able to use Arsenal in your formulas and it will result in 7.

enter image description here

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged excel or ask your own question .

Hot Network Questions

assign value to text in excel

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Login With Facebook

How to assign a value or category based on a number range in Excel?

This article is talking about assigning a value or category based on a specified number range in Excel. For example, if a person's monthly sales are between 0 and 100, the sales performance of that month will be evaluated as Poor, if between 101 and 500, evaluated as Fair, if between 501 and 1000, evaluated as Good, and if over 1000, evaluated as Excellent. The methods described in this article can help you with this task.

assign value to text in excel

Assign a value or category based on a number range with formulas

The following formulas can help to assign a value or category based on a number range in Excel. Please do as follows.

Formula 1: Using a formula with the combination of the IF function and the AND function

1. Select a blank cell, enter the following formula and press the Enter key. Select the result cell, drag its AutoFill Handle down to the cells where you want to apply the formula.

=IF(AND(B2>=0,B2<=100),"Poor",IF(AND(B2>100,B2<=500),"Fair",IF(AND(B2>500,B2<=1000),"Good",IF(AND(B2>1000),"Excellent",0))))

assign value to text in excel

Notes : If the given number is not in the specified number range, the formula will return the result as 0.

Formula 2: Using VLOOKUP function to get it done

VLOOKUP function can help to handle this problem as well.

1. Firstly, you need to create an auxiliary table as shown in the table below. The table should contain two columns, one for the sales points and the other for the corresponding category you will assign to the number range.

assign value to text in excel

2. Select a blank cell, enter the formula below and press the Enter key to get the result. Select the result cell, drag its AutoFill Handle down to the cells where you want to apply the formula.

=VLOOKUP(B2,$E$2:$F$5,2)

assign value to text in excel

Click here to know more about the VLOOKUP function.

Note: In the formula, $E$2:$F$5 is the table range we created in step 1.

Related articles:

The Best Office Productivity Tools

Kutools for excel solves most of your problems, and increases your productivity by 80%.

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

assign value to text in excel

IMAGES

  1. If Cell Contain Word Then Assign Value in Excel (4 Formulas)

    assign value to text in excel

  2. Assign Number Value to Text

    assign value to text in excel

  3. Assign Number Value to Text

    assign value to text in excel

  4. How to assign a value or category based on a number range in Excel?

    assign value to text in excel

  5. Come assegnare un nome a un intervallo di celle in Excel

    assign value to text in excel

  6. How To Put Large Numbers In Excel

    assign value to text in excel

VIDEO

  1. proper text in excel #excel #shorts #viral

  2. Text to Columns #excelshortsvideo #exceltricks #shortvideo #excel

  3. How to text add in number

  4. Add Any Text Before Number In Excel With Some Magic 😎 #shorts

  5. How to Add Custom Text with Numbers in Excel! Don't do this manually

  6. Where and how do you use TEXT Formula?

COMMENTS

  1. Assign Number Value to Text

    This tutorial will demonstrate how to assign a numerical value to a text string. assign number value to text Main. VLOOKUP Method. To assign a number value

  2. Assign numeric value to text cell

    Hello, I'm making a pricing spreadhseet and I need to assign a numeric value to a text a cell which can be selected from a multiple option

  3. SUM or AVERAGE Text Values Like Numbers in Excel

    ... file here: https://www.bluepecantraining.com/sum-or-average-text-values-like-numbers-in-excel-assign-numeric-value-to-text-and-sum-or-a.

  4. How do I assign a value to text in Excel?

    Select the cell or column that contains the text you want to split. · Select Data > Text to Columns. · In the Convert Text to Columns Wizard, select Delimited >

  5. How to Assign Value to Text and Sum in Excel (2 Easy Methods)

    How to Assign Value to Text and Sum in Excel (2 Easy Methods) · Assign Value to Texts.xlsx · =SUM(COUNTIF(C5:E5,$H$5:$H$7)*$I$5:$I$7) · =SUM(INDEX($I$5:$I$7,N(IF(1

  6. How to Assign Value If Cell Contains Word in Excel (4 Easy Ways)

    4 Easy Ways to Assign Value If Cell Contains Word in Excel · =IF(COUNTIF($B7,"*"&$C$4&"*"), B7, "Not Found") · =IF(ISNUMBER(SEARCH($C$4,$B7)),B7,"

  7. How do I assign a number value to a non-numerical value in Excel

    I would have a seperate table in another tab that details the values: Code Value VU 1 U 2 S 3 L 4 VL 5. Then, in a new column, on the survey

  8. How to convert number to text in Excel

    Select the range with the numeric values you want to format as text. Right click on them and pick the Format Cells… option from the menu list.

  9. excel

    It sounds like what you want is a defined name. Just go to the formulas ribbon and click define name. Then Type in the name of the Team and

  10. How to assign a value or category based on a number range in Excel?

    1. Select a blank cell, enter the following formula and press the Enter key. Select the result cell, drag its AutoFill Handle down to the cells where you want