Linking two excel datasheet together using python - excel

I am trying to link two excel datasheet together. So that if a cell from the first datasheet is clicked, it opens data regarding the value of that cell from a second datasheet. Here is an example for further clarification.
This is my first datasheet
0 2011 A1 SS FF
1 2100 A5 SS FF
2 2245 A3 RR 22
3 2945 A4 AA 3E
4 1140 A7 WE 7F
Now if I click A1 it should somehow provide me the data from the second datasheet, which should be NaN value and if i click A2 it should give me New York
A1
A2 New York
A3 Newfoundland
A4 Ontario
A5 Texas
A6 Nova Scotia
I apologize for not being able to provide the original data frame, due to non-disclosure reason. Any help would be greatly appreciated.
Thank you

You can link cells in other worksheets or workbook with XlsxWriter using the write_url() method with the internal: or external: uri. See the XlsxWriter docs.
This means that you will probably need to handle transferring the data outside of Pandas or else use Pandas and then overwrite the cells that you want to add links to using XlsxWriter.

Related

Excel generating prices difference between two sheets

Let's say I have a *.xlsx file that contains the following two sheets:
sheet1:
sheet2:
How can I generate a third sheet that looks like this:
sheet3:
B2 in sheet3 is -1 because 54 - 55 = -1.
B3 in sheet3 is 67 because 67 - 0 = 67. (Sheet2 doesn't have Banana item so its price of banana is set to 0).
Simplest way would be using VLOOKUP(). You can also use INDEX/MATCH or XLOOKUP() if you have Excel O365
=IFERROR(VLOOKUP(A2,Sheet1!$A$2:$B$10,2,FALSE),0)-IFERROR(VLOOKUP(A2,Sheet2!$A$2:$B$10,2,FALSE),0)
So the equation on sheet 3 has to be, =sheet1!B2 - sheet2!B2 This will solve the problem. You can get more information on Excel Formulas for Linking Data between Different Sheets
I tried but It doesn't 100% solve your problem, =IF(ISERROR(VLOOKUP(Sheet1!A1,Sheet2!$A$1:Sheet2!A10,1,FALSE)),Sheet1!B1,Sheet1!B1-Sheet2!B1)
You might be able to get an idea.

Matching cell from two values

need help here :) I am not excel expert
I have a simple spread sheet with some data and I need to find the matching values from another sheet. Some help would be appreciated.
The data looks like this:
d1 d2 d3 d4 d5
c1 1 5 4 4 3
c2 2 4 9 1 2
c3 4 4 7 8 4
c4 4 7 1 9 2
c5 4 4 7 6 8
So above c1, c2 etc. means Code's and d1, d2 etc. means Dates (future dates).
The numbers between I need to catch in a different spread sheet
example
Code: c2 - User provides the code
Date: d4 - User provides the date
Value: 1 - this value I need to get with formula
Should I attach example file if needed?
If possible to use performance wise formulas as might be quite few of them. Perhaps INDEX/MATCH? if I know how to use it :) but I think also INDEX/MATCH will slow it down a lot, I might be wrong also :)
thank you for your help in advance.
EDIT:
Added screenshot, might help also what is needed.
Assumptions / prerequisites:
Sheet1 cells (A1:F6) is your data / headers from your example
Sheet2 cell B3 is where the user types the code
Sheet2 cell B4 is where they type the date
Sheet2 cell B5 is where the value displays
this would be your formula in Sheet2 C5
=INDEX(Sheet1!A:F,MATCH(B3,Sheet1!$A:$A,0),MATCH(B4,Sheet1!1:1,0))

Multiple What IF Statement in Excel for Soccer score project

I have a long list of soccer data but in it's most simplistic form it looks like this:
A1 Barcelona
A2 Madrid
A3 2
A4 1
A5 (this will be the IF Statement)
There are over 200 rows but all with the same premice, so what I want is an if statement that says if the score in A3 is larger than A4 then A5 has a W and if A4 is a larger score than A3 than A5 has an L
Can someone give me some pointers as to how to do this, only need to know it for the top line of the data and then I can replicate throughout
Thanks
Dan
Try this if statement:
=IF(A3>A4,"W",IF(A4>A3,"L",IF(A3=A4,"Tie","")))

How do I link the content of a cell to another worksheet as opposed to the value?

I realize my title doesn't really explain what I'm asking as I don't know the correct terminology but bear with me and I'll explain my question.
I know how to link two cells so that if one changes, the other does as well (i.e. cell C3 is linked to cell E5 by selecting cell C3 and entering "=E5"). But how do I link the information in the cell to another cell?
If my worksheet looks like this:
cell B1 - Grapes, cell C1 - 50
cell B2 - Apples, cell C2 - 60
and I link cell F1 to cell C2 with "=C2". If I change the order of cell B1 and cell B2 to become alphabetical then cell F1 is no longer linked to the value in cell C2 (50) but changes to the value that now becomes cell C2 (60). How do I link cell F1 to the actual value (50) in cell C2 even if the order changes.
Help... Thank you!
Not sure if this is an efficient method; if i correctly understood your question then you can use = to link two cells For example:
Sheet one can look like this
A B C D E
1 1 2 3 4 5
2 5 4 3 2 1
3 1 2 3 4 5
Total 7 8 9 10 11
Sheet two requires cell links so you do:
TotalForA =Sheet1!A4 //output will be 7
TotalForB =Sheet1!B4 //output will be 8
.
.
.
In a simple word you can use = sign and click on whatever cell you're like to get.

Macro to split weight into columns Request

Let's say I have a column of numbers in A2 going down, to a random number, such as:
0.50
1.00
1.00
1.10
1.10
And I wanted a macro to split them into Major and Minor basically.. Anything before the Period, I want moved over to Column B. Anything after the Period I would like moved to Column C, and the . Just removed completely.
So
B C
0 50
1 00
1 00
1 10
1 10
Like that, Pretty simple. I don't know enough about Excel VBA to write it.
Just record the following macro:
Copy column A to B
Format column B as text
Data->TextToColumn on Column B with separator "."
I would just use formulas instead of VBA. Put this in B2:
=INT(A2)
and this in C2:
=(A2-B2)*100
Then copy and paste down.

Resources