Array concept and looping doubt

%3CLINGO-SUB%20id%3D%22lingo-sub-1379933%22%20slang%3D%22en-US%22%3EArray%20concept%20and%20looping%20doubt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1379933%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20attached%20excel%20you%20can%20find%20two%20columns%20of%20data%20where%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EColumn%20A-%20Industry%3C%2FP%3E%3CP%3EColumn%20B-%20Engine%20no%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20column%20F%20you%20can%20find%20the%20status%20of%20engine%2C%20here%20i%20need%20to%20get%20the%20status%20of%20engine%20output%20in%20Column%20C%20using%20VBA%20code%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet%20me%20know%20how%20to%20store%20column%20B%20in%20array%20and%20then%20looping%20thru%20each%20value%20to%20get%20desired%20output%20in%20Column%20C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20to%20make%20comparison%20here%20with%20looping%20each%20value%20from%20array%20with%20values%20from%20column%20F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20any%20way%20to%20write%20this%20in%20formula%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1379933%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1380081%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20concept%20and%20looping%20doubt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1380081%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F585099%22%20target%3D%22_blank%22%3E%40Nandhu19940%3C%2FA%3Eyou%20should%20read%20Chapter%206%2C7%2C8%20to%20complete%20this%20job.%20This%20will%20help%20you%20to%20code%20your%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fexcelsirji.com%2Fvba-for-beginners%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fexcelsirji.com%2Fvba-for-beginners%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EKapil%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1380134%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20concept%20and%20looping%20doubt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1380134%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F585099%22%20target%3D%22_blank%22%3E%40Nandhu19940%3C%2FA%3E%26nbsp%3B%20is%20this%20a%20class%20assignment%3F%26nbsp%3B%20I%20ask%20because%20you%20say%20you%20have%20to%20use%20VBA%20when%20this%20is%20a%20simple%20VLOOKUP%20function%20that%20can%20be%20put%20in%20col%20C%20(e.g.%26nbsp%3B%20%3CFONT%3E%3DVLOOKUP(B2%2C%24E%243%3A%24F%2410%2C2%2CFALSE)%20)%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1380222%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20concept%20and%20looping%20doubt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1380222%22%20slang%3D%22en-US%22%3Evar%20a%20%3D%20%5B%5D%3B%20%2F%2F%20Create%20a%20new%20empty%20array.%3CBR%20%2F%3Ea%5B5%5D%20%3D%205%3B%20%2F%2F%20Perfectly%20legal%20JavaScript%20that%20resizes%20the%20array.%3CBR%20%2F%3E%3CBR%20%2F%3Efor%20(var%20i%20%3D%200%3B%20i%20%26lt%3B%20a.length%3B%20i%2B%2B)%20%7B%3CBR%20%2F%3E%2F%2F%20Iterate%20over%20numeric%20indexes%20from%200%20to%205%2C%20as%20everyone%20expects.%3CBR%20%2F%3Econsole.log(a%5Bi%5D)%3B%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%2F*%20Will%20display%3A%3CBR%20%2F%3Eundefined%3CBR%20%2F%3Eundefined%3CBR%20%2F%3Eundefined%3CBR%20%2F%3Eundefined%3CBR%20%2F%3Eundefined%3CBR%20%2F%3E5%3CBR%20%2F%3E*%2F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1381497%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20concept%20and%20looping%20doubt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1381497%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3BThanks%20lot%26nbsp%3B%3C%2FP%3E%3CP%3EMoreover%20array%20also%20i%20need%20to%20do%20%2C%20not%20know%20how%20to%20do%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20just%20succeeded%20in%20stored%20the%20entire%20column%20values%20in%20array%20as%20variant%20but%20further%20i%20don't%20know%20how%20to%20proceed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMore%20doubts%20in%20using%20loop%20here%20in%20my%20array.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

In attached excel you can find two columns of data where 

 

Column A- Industry

Column B- Engine no

 

In column F you can find the status of engine, here i need to get the status of engine output in Column C using VBA code

 

Let me know how to store column B in array and then looping thru each value to get desired output in Column C 

 

How to make comparison here with looping each value from array with values from column F

 

Is there any way to write this in formula 

 

 

 

 

 

4 Replies
Highlighted

@Nandhu19940you should read Chapter 6,7,8 to complete this job. This will help you to code your work.

 

https://excelsirji.com/vba-for-beginners/

 

Thanks

Kapil

Highlighted

@Nandhu19940  is this a class assignment?  I ask because you say you have to use VBA when this is a simple VLOOKUP function that can be put in col C (e.g.  =VLOOKUP(B2,$E$3:$F$10,2,FALSE) )

Highlighted
var a = []; // Create a new empty array.
a[5] = 5; // Perfectly legal JavaScript that resizes the array.

for (var i = 0; i < a.length; i++) {
// Iterate over numeric indexes from 0 to 5, as everyone expects.
console.log(a[i]);
}

/* Will display:
undefined
undefined
undefined
undefined
undefined
5
*/
Highlighted

@mtarler Thanks lot 

Moreover array also i need to do , not know how to do that.

 

I just succeeded in stored the entire column values in array as variant but further i don't know how to proceed.

 

More doubts in using loop here in my array.