LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

want to search a word in a column multiple times ????

Solved!
Go to solution

Hello All,

Want to search a word in column and after that word want to read the values till i encounter blank cell, uptill this i could get the code but then in same column again i have to search for same word and again start reading. 

 

In short if i encounter word "Name" three times in one column i must start reading after that immediately three times till next very blank cell.

I am attaching code and my .xl file.

 

Hope anyone could guide me...

Thanks a lot...

pals 

Download All
0 Kudos
Message 1 of 13
(2,817 Views)

Hi pals,

1) Do you know how many times the word is going to appear in the excel sheet? You can use that as a counter and search accordingly.

2) secondly,If you know exactly how many blank spaces will be there between your data(After First appearance of word)  and next appearance of the word, you can run your while loop accordingly. I this case You need to keep last position in the memory and start searching after that position.

3) If you know How much data you need to read (for e.g.. A1 to H45). You can read that data at once, get particular column from where you want to search word and run for loop.(This is better option)

 

I hope This will help.

Best of LuckSmiley Wink

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 2 of 13
(2,773 Views)

Hi Gaurav,

Thanks but nothing is fixed in this... as on survey of month the excel-sheet will be filled and then so that name can occur once or twice or thrice also... And no of blank spaces is also not sure plus how much data i need to read is also not sure i mean not same always... So i am bit confused and i tried but i was not able to code further... 

Thanks once again..

pals

0 Kudos
Message 3 of 13
(2,756 Views)

In that case how are you going to decide when to stop? I think there will be some EOF kind of parameter.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 4 of 13
(2,745 Views)

Hi Gaurav,

Ya thats what the probelm is that nothing is fixed....  There are six headers and there column number is fixed.

It should take 1st header search in column A if the word "Name"Comes twice it should read twice just below the header Name all the exciting values, then it should go for other Header "Gruop" in Column B and do the same. And this should be done for all six headers.

 

Eg:

 A             B            C         D      E   F          G  ------ Column number from excel

Group   Number   Name  Rate  IR    FR      Freq   ----- these are headers

 1              3           fgh       23    45    56        78

 2              5           ty        56     67    67        67 

 

Group   Number    Name   Rate  IR    FR    Freq ---- 2nd set of headers

 4              3            ty           33    56   88      100

 

Hope that now i am bit clear

 

thanks a lot...

Pals

0 Kudos
Message 5 of 13
(2,736 Views)

Hi pals,

I have modified your code a bit.Now you will get all the addresses where the word is present.Now you do not need worry about when to stop.

You need to change rest of the code. Take one address at a time and get data till you find blank space.Continue this procedure for the rest.

I hope this is the solution of your problem.

 

 

Best Of LuckSmiley Wink

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
Message 6 of 13
(2,718 Views)

Hi Gaurav,

Thanks so much... Will try and let you know about it... Thanks once again....

pals

0 Kudos
Message 7 of 13
(2,704 Views)

Hi Gaurav,

Thanks so much for your suggestion. I have modified to read all the headers from excel-sheet plus all the data below those header. Thanks so much...

 

Just need one suggestion that it overrides all the data i mean i need 6 arrays to store these 6 column data.So what the option to get rid of that override of data...

Thanks once again...

pals

0 Kudos
Message 8 of 13
(2,690 Views)
Solution
Accepted by topic author Sim5

I could not open your code as I do not use Labview 2010.

But you are using while loop so if you want all data you can replace tunnel( of while loop) and select enable indexing.

It will give you 2D data. Each column for Each header.

I hope you know enable indexing concept.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
Message 9 of 13
(2,683 Views)

Hi Gaurav,

Thanks a lot... Ya i know that... Will try and let you know... Thanks...

pals

0 Kudos
Message 10 of 13
(2,680 Views)