If Statement

FanofExcel18

Board Regular
Joined
Jun 7, 2018
Messages
65
Need Help

I'm weighting hours.

Example: Work hours for the month is 150

1 = 120<
2 = 121-135
3 = 135-150
4 = 150>
 
I still don't understand, both formulae supplied give the answers you have shown.
There was no mention in your OP of a "base number" & you have not shown how that fits in.
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
[TABLE="width: 380"]
<colgroup><col><col><col span="2"><col><col></colgroup><tbody>[TR]
[TD]Time[/TD]
[TD]Amount[/TD]
[TD]Hours[/TD]
[TD][/TD]
[TD]Weighting[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD="align: right"]123[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]142[/TD]
[TD] [/TD]
[TD]125 or Less[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]127[/TD]
[TD="align: right"]2[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]126 to 135[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]162[/TD]
[TD="align: right"]4[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]136 to 142[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]136[/TD]
[TD="align: right"]3[/TD]
[TD] [/TD]
[TD] [/TD]
[TD]142 or greater[/TD]
[TD="align: right"]4[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Ok, I understand where the "base number" fits it (ie the max weighting), but the other other weightings have no changed. Are they also dependant on the base number?
 
Upvote 0
Ok, I understand where the "base number" fits it (ie the max weighting), but the other other weightings have no changed. Are they also dependant on the base number?

The Base will be whatever that month hours are. Each of the weightings will change in range depending on the month. Those I can physically change. I don't know how to get the IF statement (if that is what should be used) to push the result correctly. I hope that answers your question.
 
Upvote 0
How about


Excel 2013/2016
ABCDEF
7123114299994
812721423
916241352
1013631251
Sheet2
Cell Formulas
RangeFormula
B7=INDEX(E$7:F$10,MATCH(A7,E$7:E$10,-1),2)


where E7:F10 are a lookup table somewhere in the workbook
 
Upvote 0
How about

Excel 2013/2016
ABCDEF

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]7[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]142[/TD]
[TD="align: right"][/TD]
[TD="align: right"]9999[/TD]
[TD="align: right"]4[/TD]

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

[TD="align: center"]9[/TD]
[TD="align: right"]162[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]135[/TD]
[TD="align: right"]2[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]136[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]125[/TD]
[TD="align: right"]1[/TD]

</tbody>
Sheet2

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]B7[/TH]
[TD="align: left"]=INDEX(E$7:F$10,MATCH(A7,E$7:E$10,-1),2)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



where E7:F10 are a lookup table somewhere in the workbook

So I think this will work. Here is my problem now, I'm getting #N/A.

I think it has something to do with the 2 at the end for the column. I'm not as familiar with INDEX MATCH.

My first lookup cell is I6, my table is located AA5 to AB8
 
Upvote 0
Assuming the table is on the same sheet & it's sorted descending, try
=INDEX(AA$5:AB$8,MATCH(I6,AA$5:AB$8,-1),2)
 
Upvote 0
The location of the formula is irrelevant.
Is all the data on the same sheet?
Also is you lookup table sorted descending?
 
Upvote 0
The location of the formula is irrelevant.
Is all the data on the same sheet?
Also is you lookup table sorted descending?

I figured it out!!! And it was my error totally. I duplicated the row/column formula: =INDEX(AA$5:AB$8,MATCH(I6,AA$5:AB$8,-1),2)
When it should have been: =INDEX(AA$5:AB$8,MATCH(I6,AA$5:AA$8,-1),2)

It works, thank you for your help and patience!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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