Fill the range meeting certain criterias

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
Range D5:D17 generates numerical values. It does not generates zero or ‘’(null). D5:D17 is a non contiguous column.
Other input cells are C2; F2, G2 & H2

Output range G5:G17 to be filled with values from D meeting below criteria’s
Find the cell in D5:D17 which is ‘nearest lower value’ of C2 in multiplication of F2.
Fill corresponding row of G with $G$2.

Output range H5:H17 to be filled with values from D meeting below criteria’s
Find the cell in D5:D17 which is ‘nearest higher value’ of C2 in multiplication of F2.
Fill corresponding row of H with $H$2.

How to accomplish?
Thanks in advance.
Book2.xlsx
CDEFGH
24222910012
3
4
54210000
64220010
7
84230002
9
104260000
114280000
12
134300000
14
15
16
174350000
Sheet3
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try:

Book1
CDEFGH
24222910012
3
4
54210000
64220010
7  
84230002
9  
104260000
114280000
12  
134300000
14  
15  
16  
174350000
Sheet1
Cell Formulas
RangeFormula
G5:G17G5=IF(D5="","",IF(D5=AGGREGATE(14,6,$D$5:$D$17/($D$5:$D$17<$C$2)/($D$5:$D$17<>""),1),$G$2,0))
H5:H17H5=IF(D5="","",IF(D5=AGGREGATE(15,6,$D$5:$D$17/($D$5:$D$17>$C$2)/($D$5:$D$17<>""),1),$H$2,0))
 
Upvote 0
Solution
Try:

Book1
CDEFGH
24222910012
3
4
54210000
64220010
7  
84230002
9  
104260000
114280000
12  
134300000
14  
15  
16  
174350000
Sheet1
Cell Formulas
RangeFormula
G5:G17G5=IF(D5="","",IF(D5=AGGREGATE(14,6,$D$5:$D$17/($D$5:$D$17<$C$2)/($D$5:$D$17<>""),1),$G$2,0))
H5:H17H5=IF(D5="","",IF(D5=AGGREGATE(15,6,$D$5:$D$17/($D$5:$D$17>$C$2)/($D$5:$D$17<>""),1),$H$2,0))
Thanks Eric.. both formula meets my requirement. Thsanks for your efforts, time & willingness to help.
7 Cheers
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

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