Calculating MATCH row based on user input.

chefdt

Board Regular
Joined
Jul 1, 2008
Messages
163
I have a column of data in B from row 5 to 23 (see below). I want to accept user input in cell M25 and use that input to to select a MATCH row of data from my list below.

For example, if the user inputs $74, the row number is 3. (greater than 70, less than 80)

My column data is similar and listed below. The user would enter a value in M27 and the MATCH column would be calculated using the same assumptions.

For example, if the user inputs $1625, the MATCH column would be 5 (greater than 1500, less than 1750)

I'm new to INDEX and MATCH and even newer with trying to assign a value using user input. Thanks all.

ROW DATA in B
< $60
$60
$70
$80
$90
$100
$110
$120
$130
$140
$150
$160
$170
$180
$190
$200
$210
$235
$260

<colgroup><col></colgroup><tbody>
</tbody>

COLUMN DATA in row 4
$500 $750 $1,000 $1,250 $1,500 $1,750 $2,000 $2,250 $2,500 $2,750 $3,000 $3,250 $3,500

<tbody>
</tbody>
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
1. Make your data consistent. Remove the <$60 and replace it with 0 (assuming the amount never goes negative)

Then use
=MATCH(M25,A1:A3,1)

2. MATCH(M27,A4:M4,1)
 
Last edited:
Upvote 0
1. Make your data consistent. Remove the <$60 and replace it with 0 (assuming the amount never goes negative)

Then use
=MATCH(M25,A1:A3,1)

2. MATCH(M27,A4:M4,1)

Thanks so much. Worked perfectly after I changed the references to B5:B23 as stated above. I didn't quite understand how the 1 vs 0 worked. Great and simple example of how to use.

DT
 
Upvote 0
In a MATCH 0 indicates the value being searched for must be found in the range, e.g. MATCH(123,B5:B23,0) 123 must be in the range B5:B23 or there will be an error #N/A I think
If you change it to a 1 then the result will be the next value in the range LESS than the value being searched. So in your example it returns 70 (74 is not in the range.
 
Upvote 0
In a MATCH 0 indicates the value being searched for must be found in the range, e.g. MATCH(123,B5:B23,0) 123 must be in the range B5:B23 or there will be an error #N/A I think
If you change it to a 1 then the result will be the next value in the range LESS than the value being searched. So in your example it returns 70 (74 is not in the range.


Another question....If I wanted to highlight the cell that my INDEX(MATCH) equation references, how would I do that. Been watching some videos. Cecaus eI'm not matching exactly, conditional formatting seems out.

Thanks
 
Upvote 0
You'd have to use Condtiional formatting (or VBA which i dont know much about).

Select the range B5:B23

Conditional Formatting
New Rule
Use a formula to determine...

=(B$5:B$23=M$25)

Format as required

Be aware if you have duplicate values of M25 in the B5:B23 range conditional formatting will highlight all of them, not just one.
 
Upvote 0

Forum statistics

Threads
1,215,659
Messages
6,126,077
Members
449,286
Latest member
Lantern

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