The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Addition of column from multiple workbook
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

yashsoni06@gmail.com

India
3 Posts

Posted - 09/23/2020 :  05:54:58 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System: WINDOW 10

Dear Colleague
I have 10 workbooks in a project in which i want to perform the addition of B column of each sheet in the workbook. How can i do this in origin.
pls help me!


Vhttps://my.originlab.com/ftp/forum_and_kbase/Images/Addition%2005.opj

Edited by - yashsoni06@gmail.com on 09/23/2020 06:13:04 AM

YimingChen

1687 Posts

Posted - 09/23/2020 :  10:55:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Create a new worksheet, then run the LT script below in Window:Script Window:

range r1 = col(B);
r1 = 0;
for (int i = 1; i<=10; i++)
{
	range rr = [A$(i)]1!2;
	r1 = r1 + rr;
}


James
Go to Top of Page

yashsoni06@gmail.com

India
3 Posts

Posted - 09/24/2020 :  12:51:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear James
Thanks for reply.
I have tried to run the LT Script.But, i am unble to get the out in the worksheet.
I have 10 different worksheet named as (1.dat, 2.dat,...10.dat) located in the project window. i would like to have the 2 column of each sheet to be added and out to apperas in seprate new worksheet worksheet [book1]. I have been trying this since 4-5 days. Where is the mistake i am doing?
Origin 8.5 version


quote:
Originally posted by YimingChen

Create a new worksheet, then run the LT script below in Window:Script Window:

range r1 = col(B);
r1 = 0;
for (int i = 1; i<=10; i++)
{
	range rr = [A$(i)]1!2;
	r1 = r1 + rr;
}


James



V
Go to Top of Page

YimingChen

1687 Posts

Posted - 09/24/2020 :  09:54:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If that's the case, you can write script to loop over all workbooks in the project, add two columns of the sheet and save to a new sheet. Try script below that adds col(2) and col(3) and save to result sheet.


doc -e W  // Execute for all workbooks in the project
{
	range r1 = 2;
	range r2 = 3;
	newsheet name:=result cols:=1;
	col(A) = r1 + r2;
}


James
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000