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
 All Forums
 Origin Forum
 Origin Forum
 Multiple sheets - script window formula

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ru4n0907 Posted - 10/07/2022 : 09:07:02 AM
hello, I'm working with several sheets at the same time and I would like a formula in the script window to make the account in all of them at once. what I want is to calculate the ratio between two columns in these sheets and put it in another column and then get a specific value from that other column, for example: get the value of row 10 of that column where we calculated the ratio and put it in a new column . So I want a formula that does this in all sheets but 1, which would be, for example, the sheet ''values''
5   L A T E S T    R E P L I E S    (Newest First)
snowli Posted - 10/07/2022 : 12:20:25 PM
Do you mean you want to exclude one book in the loop?
U can wrap

if(%H != "Book4")
{

}

around
loop(ii,1,page.nlayers)
{

}



U can use Worksheet: Append Worksheet... to pick sheets and specified columns to put them into a new book.

Thanks, Snow


ru4n0907 Posted - 10/07/2022 : 11:40:45 AM
solved it in part, how do I get 1 woorkbook out of the loop?
and then how do i pass the calculated results to another woorkbook? I'm using this:

doc -ef W
{
// Loop over all worksheets in each workbook
loop(ii,1,page.nlayers)
{
range rW = [%H]$(ii)!;
rW.addCol(Result);
newColIndex = rw.nCols;
range rA = [%H]$(ii)!col(3);
range rB = [%H]$(ii)!col(4);
range rF = [%H]$(ii)!col($(newColIndex));
range rR = [%H]$(ii)!col($(newColIndex));
rR = rA / rB;


}
}
snowli Posted - 10/07/2022 : 10:17:40 AM
Yes, u can loop through all books in project.
https://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs

When u refer to sheets of current book, u don't need to have book part in formula.

You may need to define range to refer to columns in other sheets, etc. when using Labtalk

https://www.originlab.com/doc/LabTalk/guide/Worksheet-Column-Data-Manipulation


Thanks, Snow
ru4n0907 Posted - 10/07/2022 : 09:57:34 AM
so, I have 100 other books to do this account in all of them, but manually it takes time to put the formula in one by one after getting the value of a certain row of the column, I want some command to do this in all of one time
snowli Posted - 10/07/2022 : 09:36:35 AM
You can use Set Column Values dialog (F(x) cell) of a column to enter formulas to do column based calculation.
https://www.youtube.com/watch?v=vAghAi0dazM

E.g. in a column, u can enter [book1]1!B/[book2]1!B to calculate ratio between column Bs of book1's 1st sheet and book2's 1st sheet, etc.
U can also use cell formula
e.g. =[Book1]1!B[10] to refers to 10th row of column B in 1st sheet of Book1.

Maybe you can share a project so we can better understand your question.

Thanks, Snow

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000