i have a excel workbook with these two sheets in it. I am trying to sepearate product by Type into separate columns as shown on sheet 2. Any help how to do this in in excel, by reading sheet 1 and getting results into sheet 2. Thanks in Advance !!
SHEET 1
product price type
A $10.98 PD
B $54.89 SLP
C $74.99 PD
D $82.99 PD
E $54.76 SLP
F
G $76.99 PD
SHEET 2
Product PD SLP
A $10.98
B $54.89
C $74.99
D $82.99
E $54.76
F
G $76.99
I have put everything into one table for better view:
both tables next to each other
In column G i think I have written:
=If($G$1=Table1[#type];INDEX(Table1[[Product]:[price]];Match(F2;Table1[Product]);2);"")
Original in German: =WENN($G$1=Tabelle1[#type];INDEX(Tabelle1[[Product]:[price]];FINDEN(F2;Tabelle1[Product]);2);"")
Related
Want an excel sheet column with odd values but has to be duplicated.
The value of the column has to be like 1,1,3,3,5,5,7,7,9,9,11,11.... and so on until 20000/20001.
Could you let me know how to do it either in excel sheet or in pandas dataframe.
Tried duplicating in excel but it does not work.
Tried in pandas but even even numbers come up.
df['ABC'] = 2 + df.index//1
You can use numpy.arange with numpy.repeat :
import pandas as pd
import numpy as np
df = pd.Series(np.repeat(np.arange(1,20002,2),2)).to_frame("ABC")
Then (if needed) use pandas.DataFrame.to_excel to make a spreadsheet :
df.to_excel("out.xlsx", index=False)
# Output :
print(df)
ABC
0 1
1 1
2 3
3 3
4 5
... ...
19997 19997
19998 19999
19999 19999
20000 20001
20001 20001
[20002 rows x 1 columns]
Using ms365, try something like:
=TOCOL(LET(x,SEQUENCE(10001,,,2),IFERROR(EXPAND(x,,2),x)))
I convert some data into a csv string like format row by row for example the rows look like:
string format
1st row: "A,B,R,K,S,E"
2nd row: "B,C,S,E,G,Q,W,R,W" # sometimes longer rows
3rd row: "A,E,R,E,S" # sometimes shorter rows
or list format
1st row: ['A','B','R','K','S','E']
2nd row: ['B','C','S','E','G','Q','W','R','W']
3rd row: ['A','E','R','E','S']
I can also add \n at the end of each row.
I want to create a pandas dataframe from these rows but not sure how.
Normally I just save this data into a .csv file then I do pd.read_csv but I want to skip that step.
Thanks for the help
This will solve your problem:
import numpy as np
import pandas as pd
First_row=['A','B','R','K','S','E']
Second_row=['B','C','S','E','G','Q','W','R','W']
Third_row=['A','E','R','E','S']
df=pd.DataFrame({'1st row':pd.Series(First_row),'2nd row':pd.Series(Second_row),'3rd row':pd.Series(Third_row)})
answer=df.T
answer
0 1 2 3 4 5 6 7 8
1st row A B R K S E NaN NaN NaN
2nd row B C S E G Q W R W
3rd row A E R E S NaN NaN NaN NaN
Method - 1 : From List
Take 2D list and append it. Else, it would add the values in columns.
Method - 2 : From String
I have a list of data in Excel, with values attributed to the different samples. I would like to subset the top 5% from all my data. How can I do this in Excel?
sample value
a 0.6001437980
b 0.0983224370
c 0.0493093160
d 0.0427906350
e 0.0413478790
f 0.0299204810
g 0.0259600660
h 0.0215505810
i 0.0167398000
j 0.0131496290
k 0.0105364240
l 0.0082647980
m 0.0068507060
n 0.0065234580
o 0.0050233730
In cell C2, enter
=B2>=PERCENTILE($B$2:$B$63,0.95)
you can then copy this to C3:C63.
Column C now shows TRUE only for those rows with a B value in the top 5%.
Additionally you may like to apply a filter.
You can specifie rang of your data and then color it with very little effort.
Here is an example, where you can color top N records:
Hope it helps :)
How do I import from one Excel file to another using VBA?
From Req List test.xlsx Columns A B K O P L M N U V
to Req List test day count summary.xlsx Columns A B C D E F G I K L
Both files are on the same path:
C:\Users\msiddique\Desktop
The range for the rows should be unlimited, as the master file is updated daily and more rows get added.
Windows("van baan naar AX Nederland.xlsx").Activate
Cells.Select
Selection.Copy
Windows("van baan naar AX Nederland met Macro's.xlsm").Activate
Cells.Select
ActiveSheet.Paste
if you put it in the same window its pretty easy, you just have to open both files.
I have this code, and I want to run this code for 100 times. I want c and d be exported to excel with a blank column space with the previous c and d data. For example I want the next c and d go to the columns D and E in excel.
n=300;
a=mvnrnd([0 0], [1 0.5;0.5 1],n);
c=a(:,1);
d=a(:,2);
xlswrite('mani_data',c,'rawdata','A1');
xlswrite('mani_data',d,'rawdata','B1');