Formula to round up to the nearest value in a table

UncleBajubjubs

Board Regular
Joined
Jul 11, 2017
Messages
111
Office Version
  1. 2010
Hello, I have a table which shows the engine size necessary for specific horsepowers.
Example:
5 hp Size 1
10 hp Size 2
20 hp Size 3
50 hp Size 4

I want to have a cell which displays the proper engine size needed, the issue is that horsepowers can often be values in between the listed sizes, and thus aren't on the table, so the horsepower would need to be rounded up. So a 6 hp will require Size 2, 25 hp will require size 4, etc. I'm not sure how to do this properly, as simply rounding won't get me values on the table, and it always has to round up to a value on the table. Thanks.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try:

ABCDEFG
hpSize neededTable
Size 1Size 1
Size 2Size 2
Size 2Size 3
Size 4Size 4

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]5[/TD]

[TD="align: right"][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]5[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]8[/TD]

[TD="align: right"][/TD]
[TD="align: right"]5.1[/TD]
[TD="align: right"]10[/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]10[/TD]

[TD="align: right"][/TD]
[TD="align: right"]10.1[/TD]
[TD="align: right"]20[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]21[/TD]

[TD="align: right"][/TD]
[TD="align: right"]20.1[/TD]
[TD="align: right"]50[/TD]

[TD="align: right"][/TD]

</tbody>
<p s

</p>[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]B2[/TH]
[TD="align: left"]=VLOOKUP(A2,$D$2:$F$5,3)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


You can also build the table in the formula like this:

=LOOKUP(A2,{0,5.1,10.1,20.1},{"Size 1","Size 2","Size 3","Size 4"})

but it's usually easier to leave the table on the sheet somewhere so you can change it if need be.
 
Last edited:
Upvote 0
Avoids the helper column but must be sorted Highest to lowest.

Book1
AB
1HPSize need
250Size4
320Size3
410Size2
55Size1
6
7
8
91Size1
1025Size4
Sheet1
Cell Formulas
RangeFormula
B9=INDEX($B$2:$B$5,MATCH(A9,$A$2:$A$5,-1))
B10=INDEX($B$2:$B$5,MATCH(A10,$A$2:$A$5,-1))
 
Upvote 0

Forum statistics

Threads
1,223,956
Messages
6,175,612
Members
452,660
Latest member
Zatman

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