Effacer les filtres
Effacer les filtres

How to get column and row number while searching for specific text in excel.

14 vues (au cours des 30 derniers jours)
Priyanka P
Priyanka P le 2 Nov 2017
Commenté : Priyanka P le 11 Mar 2018
Get column number and Row number from excel with matched input text

Réponses (1)

Astarag Chattopadhyay
Astarag Chattopadhyay le 10 Nov 2017
Hi,
You can use the following code snippet to find out the column number and the row number of a matching string in an Excelsheet:
[data,txt] = xlsread('filename.xlsx');
num = find(contains(txt(:,:),'string to find'));
colNum = ceil(num/s(1))
rowNum = num - s(1)*(colNum-1)
Here give your Excel file name as the input in "xlsread". 'txt' contains all the data as xell array. 'num' finds the location of the string (assumption: the string is present within the file). 'colNum' and 'rowNum' calculates the corresponding column and row number of the string.
  1 commentaire
Priyanka P
Priyanka P le 11 Mar 2018
rowNum doesnt match with expected rowNum. s() for excel sheet seems not a good idea?

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by