Vba code

Andrews Felix

New Member
Joined
Sep 17, 2022
Messages
15
Office Version
  1. 2019
Platform
  1. Windows
Hi

Please help me with this, if column A is yes, and column B is advance and column c is <0.5 then D= good. And if A is yes, B is advanced and c is >500 and less than or equal to 1 then it is great. And if A is yes and b is advanced and c is greater than 1 or less than or equal to 2 then it is best. I tried with if formula, but its taking only one argument at a time. Could some one help me with a vba code. Code which applies for whole D column not only till D9
 

Attachments

  • IMG_20220917_205649.jpg
    IMG_20220917_205649.jpg
    91.3 KB · Views: 4

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
How can C be greater than 500 and less than or equal to 1? Formula would be easy enough but that doesnt make sense.
 
Upvote 0
Ok so you now have another problem. What if c is exactly 0.5? What is that supposed to produce?
 
Upvote 0
Ok so you now have another problem. What if c is exactly 0.5? What is that supposed to produce?
It's same as <0.5. if c is <= 0.5 then its good. If formula doesn't considering my second argument, i dont know why, im new and learning, any help will be appreciated. Thanks in advance
 
Upvote 0
This is a formula you could use:

=IF(AND(A1="Yes",B1="Advanced"),IF(C1<=0.5,"Good",IF(AND(C1>0.5,C1<=1),"Great",IF(AND(C1>1,C1<=2),"Best",""))),"")
 
Upvote 0
Probably the formula similar to one above will be too complicated.

But there are also other formulas - may be some combination of VLOOKUP, may be INDEX and MATCH, etc. could be used. But the solution depends on
How many columns will be examined? 3? how many of them have "clearly defined values (like your A: "Yes" and "No". And how many os such possibilities (i.e. is "May be" also possible in that colun - and what to do if such value is met. How many ranges you will have in numerical values column, and will these ranges be contignous (like from 0 to 0.5 (inclusive), from 0.5(not incl) to 1 (incl), etc. or 0..0.5 but then 1..2 and again what if below 0 and what if above maximum defined value met.

As for VBA code as suggested by title we could suggest something, but will you be able to adopt it to your needs? If no detailed description is given - I doubt, because the code will not fit your situation.
 
Upvote 0
Probably the formula similar to one above will be too complicated.

But there are also other formulas - may be some combination of VLOOKUP, may be INDEX and MATCH, etc. could be used. But the solution depends on
How many columns will be examined? 3? how many of them have "clearly defined values (like your A: "Yes" and "No". And how many os such possibilities (i.e. is "May be" also possible in that colun - and what to do if such value is met. How many ranges you will have in numerical values column, and will these ranges be contignous (like from 0 to 0.5 (inclusive), from 0.5(not incl) to 1 (incl), etc. or 0..0.5 but then 1..2 and again what if below 0 and what if above maximum defined value met.

As for VBA code as suggested by title we could suggest something, but will you be able to adopt it to your needs? If no detailed description is given - I doubt, because the code will not fit your situation.
Hi,

Thank you for the reply. 4 columns will be examined and totally there are 23 columns are there but only 4 will be examined. Out of 4, 3 has clearly defined values and 1 column has integers like <0.5, 0.5to 1, 1to2, 2 to 3, 3 to 4 like this till 9 to 10. I will check with index and match like you suggested. If there are any code you can suggest, it will be appreciated!
 
Upvote 0
OK, so data from these 3 well defined can be easily combined (concatenated) with & operator and used as headers of columns
then limiting valueas for numeric column can be used for headers of rows and finally you can use
Excel Formula:
= INDEX(table_with_values,MATCH(value,row_headers,1),MATCH(column_defined1&colun_defined2&columndefined3,columns_headers,0))
 
Upvote 0

Forum statistics

Threads
1,215,181
Messages
6,123,508
Members
449,101
Latest member
mgro123

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