Help Please

PhilWong

New Member
Joined
May 20, 2018
Messages
4
How do I write a formula for the yellow box that will return a category in column D from the spend value.

[TABLE="width: 193"]
<colgroup><col width="33" style="width: 25pt; mso-width-source: userset; mso-width-alt: 1206;"> <col width="75" style="width: 56pt; mso-width-source: userset; mso-width-alt: 2742;" span="3"> <tbody>[TR]
[TD="class: xl603, width: 33, bgcolor: transparent"][/TD]
[TD="class: xl609, width: 75, bgcolor: transparent"]Spend[/TD]
[TD="class: xl603, width: 75, bgcolor: transparent"][/TD]
[TD="class: xl609, width: 75, bgcolor: transparent"]Category[/TD]
[/TR]
[TR]
[TD="class: xl603, bgcolor: transparent"][/TD]
[TD="class: xl611, bgcolor: transparent"]£5,323.24[/TD]
[TD="class: xl603, bgcolor: transparent"][/TD]
[TD="class: xl610, bgcolor: yellow"] [/TD]
[/TR]
[TR]
[TD="class: xl603, bgcolor: transparent"][/TD]
[TD="class: xl603, bgcolor: transparent"][/TD]
[TD="class: xl603, bgcolor: transparent"][/TD]
[TD="class: xl603, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl602, bgcolor: transparent"]A[/TD]
[TD="class: xl602, bgcolor: transparent"]B[/TD]
[TD="class: xl602, bgcolor: transparent"]C[/TD]
[TD="class: xl602, bgcolor: transparent"]D[/TD]
[/TR]
[TR]
[TD="class: xl604, bgcolor: #99CCFF"]1[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]£0[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]>=[/TD]
[TD="class: xl604, bgcolor: #99CCFF"]1[/TD]
[/TR]
[TR]
[TD="class: xl606, bgcolor: #CCFFFF"]2[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]£2,500[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]>=[/TD]
[TD="class: xl606, bgcolor: #CCFFFF"]1[/TD]
[/TR]
[TR]
[TD="class: xl604, bgcolor: #99CCFF"]3[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]£2,501[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]>=[/TD]
[TD="class: xl604, bgcolor: #99CCFF"]2[/TD]
[/TR]
[TR]
[TD="class: xl606, bgcolor: #CCFFFF"]4[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]£5,000[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]>=[/TD]
[TD="class: xl606, bgcolor: #CCFFFF"]2[/TD]
[/TR]
[TR]
[TD="class: xl604, bgcolor: #99CCFF"]5[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]£5,001[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]>=[/TD]
[TD="class: xl604, bgcolor: #99CCFF"]3[/TD]
[/TR]
[TR]
[TD="class: xl606, bgcolor: #CCFFFF"]6[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]£10,000[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]>=[/TD]
[TD="class: xl606, bgcolor: #CCFFFF"]3[/TD]
[/TR]
[TR]
[TD="class: xl604, bgcolor: #99CCFF"]7[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]£10,001[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]>=[/TD]
[TD="class: xl604, bgcolor: #99CCFF"]4[/TD]
[/TR]
[TR]
[TD="class: xl606, bgcolor: #CCFFFF"]8[/TD]
[TD="class: xl608, bgcolor: #CCFFFF"]£25,000[/TD]
[TD="class: xl608, bgcolor: #CCFFFF"]>=[/TD]
[TD="class: xl606, bgcolor: #CCFFFF"]4[/TD]
[/TR]
[TR]
[TD="class: xl604, bgcolor: #99CCFF"]9[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]£25,001[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]>=[/TD]
[TD="class: xl604, bgcolor: #99CCFF"]5[/TD]
[/TR]
[TR]
[TD="class: xl606, bgcolor: #CCFFFF"]10[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]£50,000[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]>=[/TD]
[TD="class: xl606, bgcolor: #CCFFFF"]5[/TD]
[/TR]
[TR]
[TD="class: xl604, bgcolor: #99CCFF"]11[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]£50,001[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]>=[/TD]
[TD="class: xl604, bgcolor: #99CCFF"]6[/TD]
[/TR]
[TR]
[TD="class: xl606, bgcolor: #CCFFFF"]12[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]£100,000[/TD]
[TD="class: xl607, bgcolor: #CCFFFF"]>=[/TD]
[TD="class: xl606, bgcolor: #CCFFFF"]6[/TD]
[/TR]
[TR]
[TD="class: xl604, bgcolor: #99CCFF"]13[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]£100,001[/TD]
[TD="class: xl605, bgcolor: #99CCFF"]>=[/TD]
[TD="class: xl604, bgcolor: #99CCFF"]7[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Happy to help, glad it worked. Thanks for the feedback.

Just as a side note, it's the "TRUE" argument that is important in your case. Approximate match = nearest but not greater than. If you change the order of your table, it will give you a result you're not expecting. If you don't use FALSE for the last argument, your table MUST be sorted A->Z (or low to high, however you want to look at it).

For instance, this:


Book1
BCD
15323.243
20>=1
32500>=1
42501>=2
55000>=2
65001>=3
710000>=3
810001>=4
925000>=4
1025001>=5
1150000>=5
1250001>=6
13100000>=6
14100001>=7
Sheet1
Cell Formulas
RangeFormula
D1=VLOOKUP(B1,B2:D14,3,TRUE)


gives the correct result, while this:


Book1
BCD
15323.24#N/A
2100001>=7
3100000>=6
450001>=6
550000>=5
625001>=5
725000>=4
810001>=4
910000>=3
105001>=3
115000>=2
122501>=2
132500>=1
140>=1
Sheet1
Cell Formulas
RangeFormula
D1=VLOOKUP(B1,B2:D14,3,TRUE)


returns an error.
 
Upvote 0
And by the way, if you DO use "FALSE" as the last argument...in your case, you won't get a result at all. It will be looking for 5323.24 and won't find it...and so will result in an error.


Book1
BCD
15323.24#N/A
20>=1
32500>=1
42501>=2
55000>=2
65001>=3
710000>=3
810001>=4
925000>=4
1025001>=5
1150000>=5
1250001>=6
13100000>=6
14100001>=7
Sheet1
Cell Formulas
RangeFormula
D1=VLOOKUP(B1,B2:D14,3,FALSE)
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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