Extracting a value from a datatable


I have a datatable which contains only columns and 1 row

Columns: XXJanuaryXX XXFebruaryXX XXMarchXX
Values: 5 10 15

Now I have a variable that contains three first letters of a month so my variable month=MAR

now I need to get a value of 15 but when my var month=JAN then I need value 5

how I can do this?

To get a specific value when I know only that columnname = contains myvariable

Hi @JennZabba ,

Maybe you could try specifying the below Expression to get the column name :

DateTime.ParseExact("JAN", "MMM", System.Globalization.CultureInfo.InvariantCulture ).ToString("MMMM")


In place of "JAN", you could use your Variable.

this were just examples my case is more complicated, I don’t have any months I just know that the column name will contain a word that is my variable

@JennZabba ,

We would need more details on what data samples could be present. And I believe maybe a Standardization of the Inputs would be required before proceeding if there are many complications.

However, Let us know some more details on the Column Name formats, for the above, we assumed only Month names would be present.

If there can be any random names, we would need to understand How much of the Column Name is unique and would you be receiving that Unique part of the Column name, if else there would be multiple matches on the column names found.

So, Performing an analysis/Standardizing the Data at the beginning would help.