0

In my excel file, I have a list of some 7000-8000 binary chemical compounds. (Consists of 2 elements only).

And I have segregated them into their component elements, i.e., I have 2 columns of elements, namely: First Element and Second Element.

I have attached a screenshot below:

enter image description here

Now I want to fill in the respective Atomic Number and Atomic Weight beside every element as per a predefined list using Python.

How do I do that?

I have attached a screenshot of my predefined list below, as well:

enter image description here

People have told me things like, use the "CSV" package or the "pandas" package, but I would request some more procedural help wrt to the above packages or any other method you might suggest.

Also, if it cannot be done via Python, I am open to other languages as well.

Pranoy Ray
  • 33
  • 7

1 Answers1

0

I noticed that your task does not require python programming. The reason is :

  1. You already have a predefined list of items stored in a excel sheet.
  2. Excel already has built in function (VLOOKUP) for this task.

We just have to use VLOOKUP function in column Atomic number, Atomic weight ( you have to create columns in data2 sheet ) which will take care of searching for particular element atomic weight, number and return it in active cell.

Next, use fill handle to apply the function to all the cells or ( if data is in table , great!! no need to use fill handle because table automatically applies the function to whole column range )

I expect that you already know how to work with excel formulas and functions, if not comment down below for further assistance. Kindly upvote the answer if you liked it.

NOTE: If you need automation, then be sure to check out Excel VBA, google sheets, Apps script.

  • Yeah this works, but not for duplicate values. You see, elements are repeated across alloys and compounds.(Check the data screenshots above) – Pranoy Ray Aug 20 '20 at 14:22
  • Elements are repeated across alloys and compounds: Its correct that Elements are repeated in First and Second Element Column to make different compounds. For example Ag, Ca,Hf, Be are repeated to make compounds like CaAg, CaAg2, Ca5Ag3, etc. But Atomic number and Atomic weights of elements will not change as per the second Workbook (Properties). It contains Unique values only. Right? So Vlookup function will look for the values and paste it in Atomic number and Atomic Weight column respectively. – Jay Bharadia Aug 21 '20 at 14:29