Clustering values

cogumelo

Board Regular
Joined
Mar 23, 2006
Messages
181
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a list of values where i want to use a formula to fill the last column (Q) with the corresponding value q1, q2, q3 or q4 that is defined in the second table.

Can anyone help out with the correct formula to do this?

thx in advance

list
[TABLE="width: 500"]
<tbody>[TR]
[TD]name[/TD]
[TD]value[/TD]
[TD]Q[/TD]
[/TR]
[TR]
[TD]text1[/TD]
[TD]99[/TD]
[TD]q1[/TD]
[/TR]
[TR]
[TD]text2[/TD]
[TD]101[/TD]
[TD]q2[/TD]
[/TR]
[TR]
[TD]text3[/TD]
[TD]200[/TD]
[TD]...[/TD]
[/TR]
[TR]
[TD]text4[/TD]
[TD]500[/TD]
[TD]...[/TD]
[/TR]
[TR]
[TD]text5[/TD]
[TD]1[/TD]
[TD]...[/TD]
[/TR]
</tbody>[/TABLE]



[TABLE="width: 500"]
<tbody>[TR]
[TD]q1[/TD]
[TD]>0[/TD]
[TD]<100[/TD]
[/TR]
[TR]
[TD]q2[/TD]
[TD]>101[/TD]
[TD]<200[/TD]
[/TR]
[TR]
[TD]q3[/TD]
[TD]>201[/TD]
[TD]<300[/TD]
[/TR]
[TR]
[TD]q4[/TD]
[TD]>301[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
If your second table doesn't change you can use
=LOOKUP(B2,{0,101,201,301},{"q1","q2","q3","q4"})
 
Upvote 0
If your second table doesn't change you can use
=LOOKUP(B2,{0,101,201,301},{"q1","q2","q3","q4"})

Hi Fluff,

Thanks. It works perfectly but they do change every now and then. Can you show me how you would do it in that case?

thx in advance
 
Upvote 0
How about


Excel 2013 32 bit
ABC
1namevalue
2text199q1
3text2101q2
4text3301q4
5text4500q4
6text51q1
7
8
9
10
11q10
12q2101
13q3201
14q4301
Summary 1
Cell Formulas
RangeFormula
C2=INDEX(A$11:B$14,MATCH(B2,B$11:B$14,1),1)



Where the green cells represent the lookup table
 
Last edited:
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top