Filter and display specific cell value from multiple columns

Hi All,

I have question as below mentioned. how to display specific cell value from multiple columns.

Problem :

i) There is excel sheet filled with data as shown below :

Year Physics Chemistry Medicine Physiology Literature Peace Economics
2000 Jack Kilby;
Zhores Alferov;
Herbert Kroemer
Alan J. Heeger;
Alan MacDiarmid;
Hideki Shirakawa
Arvid Carlsson;
Paul Greengard;
Eric Kandel
Gao Xingjian Kim Dae-jung James Heckman;
Daniel McFadden
2001 John C. Mather;
George Smoot
Roger D. Kornberg Andrew Fire;
Craig Mello
Orhan Pamuk Muhammad Yunus;
Grameen Bank
Edmund Phelps
2002 Albert Fert;
Peter Grünberg
Gerhard Ertl Mario Capecchi;
Martin Evans;
Oliver Smithies
Doris Lessing Intergovernmental Panel on Climate Change;
Al Gore
Leonid Hurwicz;
Eric Maskin;
Roger Myerson

ii) Ask user inputs: Year and Field

  • display the Nobel Laureate for the given inputs

  • ex: The year 2002, Field selected : Chemistry then Display : Gerhard Ertl

Anyone help me with expression to get specific selected cell name from multiple columns given.

Thank you.

try this
Main (1).xaml (11.0 KB)

logic

  1. read table
  2. ask user for year/field
  3. filter datatable where year=user year and output 1 column which is the user field
    image
    image

4. dt.rows(0)(0) will give you your answer

1 Like

Thanks Buddy.

1 Like

DT.Asenumerable.Where(Function(r) r(0).To string.Equals(Year_Var)).Select(Function(r1) r1(Field_Var).Tostring).First

1 Like

Hi bro,

InputSheet1.AsEnumerable.Where(Function(r(0).Equal(Input1)).Select(Funcation(r1)r1(Input2)) is this correct expression.

bcz if I try to add .tostring and .first it is not showing also it is now showing error as valid continuation expression expected.

Bro…You are Doing Mistake while Write the Query …You Need to Write it as…Function(r)

Crosscheck Once.

1 Like

Got it. Thanks for helping.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.