English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need to assign numbers 1 - 3 for a column of data. The range will change for each new column. For one column, I have a range of numbers from 58.6 to 1000. I need to assign number 3 for numbers above 217, assign #2 for those numbers between 130.5 adn 217, and then assign #1 for numbers below 130.5. How can I set up If - Then statements to do this?

2006-07-12 09:12:12 · 3 answers · asked by Flutterfly25 1 in Computers & Internet Programming & Design

3 answers

You do it with the IF function:

=IF(A1<130.5,1,IF(A1<=217,2,3))

Replace A1 with a cell, copy/paste for the other cells.

2006-07-12 09:38:31 · answer #1 · answered by Locoluis 7 · 0 0

Use
Dim sht as Worksheet
Set sht = ActiveWindow.ActiveSheet
NextCell = 1
With sht
CurrentCell = .cell(1, 1)
Do while not IsEmpty(.cell(Nextcell, 1))
Select Case .cell(Nextcell, 1)
Case > 217
.cell(NextCell, 1) = 3
Case is Between 130.5 to 217
.cell(NextCell, 1) = 2
Case < 130.5
.cell(NextCell, 1) = 1
End Select
NextCell = CurrentCell.Offset 1
Loop
End with

Helmut

2006-07-12 09:31:39 · answer #2 · answered by hswes 2 · 0 0

In the cell you want the #1, #2 or #3 to appear write this:
=IF(C10<130.5;1;IF(C10>130.5;B12;IF(C10>217;3;2)))

where c10 is the cell you are analysing if it is between 0 and 130,5 or between 130,5 and 217 or >217.

2006-07-13 04:42:53 · answer #3 · answered by Makiavel 3 · 0 0

fedest.com, questions and answers