VBA or IF & OR function for algorithm

jo_hivera

New Member
Joined
May 29, 2020
Messages
28
Office Version
  1. 2019
Platform
  1. Windows
I need help automating an algorithm, where A is the Nr., that is freely inserted (i.e.: 12, 500, 175, 4, ...).
Cell C should recognize the number (as <100 to >5.000) from cell A, and the risk level accordingly on cell B, from No to High and present the result on cell C.
There is a second table with all the variables for this.

Is there a better/faster way, either VBA or i.e. IF function to do this?
 

Attachments

  • Sem Título1.png
    Sem Título1.png
    28.7 KB · Views: 11

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
How about

+Fluff New.xlsm
ABCDEFGHI
1NrLevelResult
212No15%NrNoLowMediumHigh
35500Medium15%015%20%25%30%
4750High28%10110%18%23%28%
5120No10%10017%15%20%25%
625Low20%50015%12%15%22%
Rota
Cell Formulas
RangeFormula
C2:C6C2=INDEX($F$3:$I$6,MATCH(A2,$E$3:$E$6,1),MATCH(B2,$F$2:$I$2,0))
 
Upvote 0
Just needs a basic index match function

Change the numbers in E3:E6 to 0, 100, 1000 and 5000, then enter the formula into C2 and fill down.

=IFERROR(INDEX($F$3:$I$6,MATCH($A2,$E$3:$E$6),MATCH($B2,$F$2:$I$2,0),"")

You may need to translate the function names to your own language and replace the commas with semicolons.
 
Upvote 0
Just needs a basic index match function

Change the numbers in E3:E6 to 0, 100, 1000 and 5000, then enter the formula into C2 and fill down.

=IFERROR(INDEX($F$3:$I$6,MATCH($A2,$E$3:$E$6),MATCH($B2,$F$2:$I$2,0),"")

You may need to translate the function names to your own language and replace the commas with semicolons.
Thank you so much! I gave it a try it only worked without the =IFERROR for some reason, seems to be working like a charm...
 
Upvote 0
How about

+Fluff New.xlsm
ABCDEFGHI
1NrLevelResult
212No15%NrNoLowMediumHigh
35500Medium15%015%20%25%30%
4750High28%10110%18%23%28%
5120No10%10017%15%20%25%
625Low20%50015%12%15%22%
Rota
Cell Formulas
RangeFormula
C2:C6C2=INDEX($F$3:$I$6,MATCH(A2,$E$3:$E$6,1),MATCH(B2,$F$2:$I$2,0))
Thank you so much! It worked like a charm!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Oops, typo caused that,

=IFERROR(INDEX($F$3:$I$6,MATCH($A2,$E$3:$E$6),MATCH($B2,$F$2:$I$2,0)),"")
Ah! I was adding the ")" to try and fix it as well on the wrong side!
It's working! Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,215,012
Messages
6,122,682
Members
449,091
Latest member
peppernaut

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