If formula with values between x and y

Linsie

New Member
Joined
Jul 19, 2012
Messages
29
Office Version
  1. 2021
Platform
  1. Windows
Hi,
I am working on a weight ranking for my projects. I have worked out all the totals etc but now getting stuck on my IF formula. Would be grateful for some assistance as been looking at it a while now and cant see where I am going wrong.

Some background. I have a chart where we have broken down the topics that will end up giving us a weight score. The sum total will tell us what the weight score is. ie if between 0-5 (0%) then the weight that should be returned is 0, between 5 and 10 (20%), then 1 should be returned and so on. Each weight is based on a %age of the points.

There is not any false statements on this, but if i took out the last ,"" then the formula would not work at all. Currently it just returns "FALSE" as the result.

The formula I was trying was (this is based on the Risk Category)
=IF(OR(G3=0,K3),IF(OR(G3>0,G3<5,K4),IF(OR(G3>5,G3<10,K5),IF(OR(G3>10,G3<15,K6),IF(OR(G3>15,G3<20,K7),IF(OR(G3>20,G3<25,K8),""))))))

Thanks in advance.

weighting.xlsx
ABCDEFGHIJKLMNOPQRS
1
2KeepTotal PointsSubCategory PointsInclude or NotWeight PointsSmartsheet WeightSmartsheet WeighScore ValueRiskCostResoucesI&UBVT&DTraining
3RiskComplianceY253Y15FALSE00%0000000
4DBA Team (Infosys)Y3Y120%5443211
5Export/ShippingY3Y240%10886422
6Hardware AvailabilityY3N360%1512129633
7Hot WorksY2N480%20161612844
8Information SecurityY3N5100%252020151055
9Microsoft LicensingY2N
10Team CooperationY3Y
11WFMsY3Y
12CostsExternal LabourY203Y14
13Internal LabourY2Y
14LicensingY2N
15MaintenanceY3Y
16Power ConsumptionY2Y
17SavingsY4Y
18ShippingY4N
19ResourcesExportY202Y10
20Hot worksY2Y
21ODCMY2N
22OSESY2Y
23OSSY2N
24Other Teams ie DBA/IDNY2Y
25Purchasing & SourcingY2N
26SD/MPGY2N
27VDCY2Y
28WFMY2N
29Importance / UrgencyBudgetY154Y8
30EOLY4Y
31Strategic NeedY7N
32Business ValueAligns with goalsY104Y7
33Future ProofingY3N
34RevenueY3Y
35Time/DurationShort - Up to 6 monthsY52Y2
36Long - 6+ MonthsY3N
37TrainingNot RequiredY51Y1
38RequiredY4N
Sheet2
Cell Formulas
RangeFormula
H3H3=IF(OR(G3=0,K3),IF(OR(G3>0,G3<5,K4),IF(OR(G3>5,G3<10,K5),IF(OR(G3>10,G3<15,K6),IF(OR(G3>15,G3<20,K7),IF(OR(G3>20,G3<25,K8),""))))))
M3:M8M3=$D$3*L3
N3:N8N3=$D$12*L3
O3:O8O3=$D$19*L3
P3:P8P3=$D$29*L3
Q3:Q8Q3=$D$32*L3
R3:R8R3=$D$35*L3
S3:S8S3=$D$37*L3
G3G3=SUMIF(F3:F11,"Y",E3:E11)
G12G12=SUMIF(F12:F18,"Y",E12:E18)
G19G19=SUMIF(F19:F28,"Y",E19:E28)
G29,G32G29=SUMIF(F29:F31,"Y",E29:E31)
G35,G37G35=SUMIF(F35:F36,"Y",E35:E36)
 

Attachments

  • Picture2.png
    Picture2.png
    169.4 KB · Views: 18

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I think this does what you're after. Your original formula has the "result if true" condition inside of your "OR" statements, which is at least part of the problem. If you structure your IFs in ascending order, you shouldn't need the OR statements, as you'll always be comparing to a greater number at each step, and the IF will stop when it first encounters "true".

Book1
ABCDEFGHIJKLMNOPQRS
1
2KeepTotal PointsSubCategory PointsInclude or NotWeight PointsSmartsheet WeightSmartsheet WeighScore ValueRiskCostResoucesI&UBVT&DTraining
3RiskComplianceY253Y15100%0000000
4DBA Team (Infosys)Y3Y120%5443211
5Export/ShippingY3Y240%10886422
6Hardware AvailabilityY3N360%1512129633
7Hot WorksY2N480%20161612844
8Information SecurityY3N 5100%252020151055
9Microsoft LicensingY2N
10Team CooperationY3Y
11WFMsY3Y
12CostsExternal LabourY203Y141
13Internal LabourY2Y
14LicensingY2N
15MaintenanceY3Y
16Power ConsumptionY2Y
17SavingsY4Y
18ShippingY4N
19ResourcesExportY202Y101
20Hot worksY2Y
21ODCMY2N
22OSESY2Y
23OSSY2N
24Other Teams ie DBA/IDNY2Y
25Purchasing & SourcingY2N
26SD/MPGY2N
27VDCY2Y
28WFMY2N
Sheet1
Cell Formulas
RangeFormula
G3G3=SUMIF(F3:F11,"Y",E3:E11)
H3,H19,H12H3=IF(G3=0,0,IF(G3<=$L$4*100,$K$4,IF(G3<=$L$5*100,$K$5,IF(G3<=$L$6*100,$K$6,IF(G3<=$L$7*100,$K$7,IF(G3<=$L$8*100,$K$8,""))))))
G12G12=SUMIF(F12:F18,"Y",E12:E18)
G19G19=SUMIF(F19:F28,"Y",E19:E28)
M3:M8M3=$D$3*L3
N3:N8N3=$D$12*L3
O3:O8O3=$D$19*L3
P3:P8P3=$D$29*L3
Q3:Q8Q3=$D$32*L3
R3:R8R3=$D$35*L3
S3:S8S3=$D$37*L3
I8I8=IF(G3=0,0,IF(G3<=$L$4,$K$4,IF(G3<=$L$5,$K$5,IF(G3<=$L$6,$K$6,IF(G3<=$L$7,$K$7,IF(G3<=$L$8,$K$8,""))))))
 
Upvote 0
I think this does what you're after. Your original formula has the "result if true" condition inside of your "OR" statements, which is at least part of the problem. If you structure your IFs in ascending order, you shouldn't need the OR statements, as you'll always be comparing to a greater number at each step, and the IF will stop when it first encounters "true".

Book1
ABCDEFGHIJKLMNOPQRS
1
2KeepTotal PointsSubCategory PointsInclude or NotWeight PointsSmartsheet WeightSmartsheet WeighScore ValueRiskCostResoucesI&UBVT&DTraining
3RiskComplianceY253Y15100%0000000
4DBA Team (Infosys)Y3Y120%5443211
5Export/ShippingY3Y240%10886422
6Hardware AvailabilityY3N360%1512129633
7Hot WorksY2N480%20161612844
8Information SecurityY3N 5100%252020151055
9Microsoft LicensingY2N
10Team CooperationY3Y
11WFMsY3Y
12CostsExternal LabourY203Y141
13Internal LabourY2Y
14LicensingY2N
15MaintenanceY3Y
16Power ConsumptionY2Y
17SavingsY4Y
18ShippingY4N
19ResourcesExportY202Y101
20Hot worksY2Y
21ODCMY2N
22OSESY2Y
23OSSY2N
24Other Teams ie DBA/IDNY2Y
25Purchasing & SourcingY2N
26SD/MPGY2N
27VDCY2Y
28WFMY2N
Sheet1
Cell Formulas
RangeFormula
G3G3=SUMIF(F3:F11,"Y",E3:E11)
H3,H19,H12H3=IF(G3=0,0,IF(G3<=$L$4*100,$K$4,IF(G3<=$L$5*100,$K$5,IF(G3<=$L$6*100,$K$6,IF(G3<=$L$7*100,$K$7,IF(G3<=$L$8*100,$K$8,""))))))
G12G12=SUMIF(F12:F18,"Y",E12:E18)
G19G19=SUMIF(F19:F28,"Y",E19:E28)
M3:M8M3=$D$3*L3
N3:N8N3=$D$12*L3
O3:O8O3=$D$19*L3
P3:P8P3=$D$29*L3
Q3:Q8Q3=$D$32*L3
R3:R8R3=$D$35*L3
S3:S8S3=$D$37*L3
I8I8=IF(G3=0,0,IF(G3<=$L$4,$K$4,IF(G3<=$L$5,$K$5,IF(G3<=$L$6,$K$6,IF(G3<=$L$7,$K$7,IF(G3<=$L$8,$K$8,""))))))

Amazing, thank you Asbestos_Jen! I had gone (as my boss puts it) excel blind and couldn't see the answer for looking.
Appreciate your assistance.

 
Upvote 0
I just realized I was comparing to the wrong column (score value instead of risk). This should work better.
2024-02-29.xlsx
ABCDEFGHIJKLMNOPQRS
1
2KeepTotal PointsSubCategory PointsInclude or NotWeight PointsSmartsheet WeightSmartsheet WeighScore ValueRiskCostResoucesI&UBVT&DTraining
3RiskComplianceY253Y15300%0000000
4DBA Team (Infosys)Y3Y120%5443211
5Export/ShippingY3Y240%10886422
6Hardware AvailabilityY3N360%1512129633
7Hot WorksY2N480%20161612844
8Information SecurityY3N 5100%252020151055
9Microsoft LicensingY2N
10Team CooperationY3Y
11WFMsY3Y
12CostsExternal LabourY203Y143
13Internal LabourY2Y
14LicensingY2N
15MaintenanceY3Y
16Power ConsumptionY2Y
17SavingsY4Y
18ShippingY4N
19ResourcesExportY202Y102
20Hot worksY2Y
21ODCMY2N
22OSESY2Y
23OSSY2N
24Other Teams ie DBA/IDNY2Y
25Purchasing & SourcingY2N
26SD/MPGY2N
27VDCY2Y
28WFMY2N
29Importance / UrgencyBudgetY154Y82
30EOLY4Y
31Strategic NeedY7N
32Business ValueAligns with goalsY104Y72
33Future ProofingY3N
34RevenueY3Y
35Time/DurationShort - Up to 6 monthsY52Y21
36Long - 6+ MonthsY3N
37TrainingNot RequiredY51Y11
38RequiredY4N
Sheet1
Cell Formulas
RangeFormula
G3G3=SUMIF(F3:F11,"Y",E3:E11)
H3,H37,H35,H32,H29,H19,H12H3=IF(G3=0,0,IF(G3<=$M$4,$K$4,IF(G3<=$M$5,$K$5,IF(G3<=$M$6,$K$6,IF(G3<=$M$7,$K$7,IF(G3<=$M$8,$K$8,""))))))
G12G12=SUMIF(F12:F18,"Y",E12:E18)
G19G19=SUMIF(F19:F28,"Y",E19:E28)
G29,G32G29=SUMIF(F29:F31,"Y",E29:E31)
G35,G37G35=SUMIF(F35:F36,"Y",E35:E36)
M3:M8M3=$D$3*L3
N3:N8N3=$D$12*L3
O3:O8O3=$D$19*L3
P3:P8P3=$D$29*L3
Q3:Q8Q3=$D$32*L3
R3:R8R3=$D$35*L3
S3:S8S3=$D$37*L3
I8I8=IF(G3=0,0,IF(G3<=$L$4,$K$4,IF(G3<=$L$5,$K$5,IF(G3<=$L$6,$K$6,IF(G3<=$L$7,$K$7,IF(G3<=$L$8,$K$8,""))))))
 
Upvote 0
Solution
I just realized I was comparing to the wrong column (score value instead of risk). This should work better.
2024-02-29.xlsx
ABCDEFGHIJKLMNOPQRS
1
2KeepTotal PointsSubCategory PointsInclude or NotWeight PointsSmartsheet WeightSmartsheet WeighScore ValueRiskCostResoucesI&UBVT&DTraining
3RiskComplianceY253Y15300%0000000
4DBA Team (Infosys)Y3Y120%5443211
5Export/ShippingY3Y240%10886422
6Hardware AvailabilityY3N360%1512129633
7Hot WorksY2N480%20161612844
8Information SecurityY3N 5100%252020151055
9Microsoft LicensingY2N
10Team CooperationY3Y
11WFMsY3Y
12CostsExternal LabourY203Y143
13Internal LabourY2Y
14LicensingY2N
15MaintenanceY3Y
16Power ConsumptionY2Y
17SavingsY4Y
18ShippingY4N
19ResourcesExportY202Y102
20Hot worksY2Y
21ODCMY2N
22OSESY2Y
23OSSY2N
24Other Teams ie DBA/IDNY2Y
25Purchasing & SourcingY2N
26SD/MPGY2N
27VDCY2Y
28WFMY2N
29Importance / UrgencyBudgetY154Y82
30EOLY4Y
31Strategic NeedY7N
32Business ValueAligns with goalsY104Y72
33Future ProofingY3N
34RevenueY3Y
35Time/DurationShort - Up to 6 monthsY52Y21
36Long - 6+ MonthsY3N
37TrainingNot RequiredY51Y11
38RequiredY4N
Sheet1
Cell Formulas
RangeFormula
G3G3=SUMIF(F3:F11,"Y",E3:E11)
H3,H37,H35,H32,H29,H19,H12H3=IF(G3=0,0,IF(G3<=$M$4,$K$4,IF(G3<=$M$5,$K$5,IF(G3<=$M$6,$K$6,IF(G3<=$M$7,$K$7,IF(G3<=$M$8,$K$8,""))))))
G12G12=SUMIF(F12:F18,"Y",E12:E18)
G19G19=SUMIF(F19:F28,"Y",E19:E28)
G29,G32G29=SUMIF(F29:F31,"Y",E29:E31)
G35,G37G35=SUMIF(F35:F36,"Y",E35:E36)
M3:M8M3=$D$3*L3
N3:N8N3=$D$12*L3
O3:O8O3=$D$19*L3
P3:P8P3=$D$29*L3
Q3:Q8Q3=$D$32*L3
R3:R8R3=$D$35*L3
S3:S8S3=$D$37*L3
I8I8=IF(G3=0,0,IF(G3<=$L$4,$K$4,IF(G3<=$L$5,$K$5,IF(G3<=$L$6,$K$6,IF(G3<=$L$7,$K$7,IF(G3<=$L$8,$K$8,""))))))
Thanks, I spotted that and changed it over to the risk column. Very happy now, I can now sleep without dreaming of the formula lol
 
Upvote 0
@Linsie, I'm curious about the version of Excel you are using...you can update your profile to show that. I ask because there may be better ways to deal with the changing range references within each of the row groupings should the number of topics change within some of them.

And if you are interesting in an alternative formula for the Weight factor, this eliminates the need to use the reference table:
Excel Formula:
=INDEX({0,1,2,3,4,5},MATCH(TRUE,G3<={0,5,10,15,20,25},0))
 
Upvote 0
@Linsie, I'm curious about the version of Excel you are using...you can update your profile to show that. I ask because there may be better ways to deal with the changing range references within each of the row groupings should the number of topics change within some of them.

And if you are interesting in an alternative formula for the Weight factor, this eliminates the need to use the reference table:
Excel Formula:
=INDEX({0,1,2,3,4,5},MATCH(TRUE,G3<={0,5,10,15,20,25},0))
Thanks Kirk, I am using Excel 2021 however, I am only using that to build my queries. I am then uploading them into Smartsheet. Not all formulas that are available in Excel are in Smartsheet. But I will certainly see if your approach will be accepted as well. Thank you.
 
Upvote 0
Ahh...okay. The formula I posted should work, but it's probably better not to go further with the other formulas. Briefly, I thought about constructing an array to uniquely identify each row grouping, and then sum within those groups...but the approach relies on Excel 365 functionality. With that approach, you wouldn't need to specify different ranges for Risk (E3:E11), Costs (E12:E18), etc.
 
Upvote 0
Thanks, I spotted that and changed it over to the risk column. Very happy now, I can now sleep without dreaming of the formula lol
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,633
Members
452,661
Latest member
Nonhle

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