View previous topic :: View next topic
|
Author |
Message |
Saravana Manikandan
New User
Joined: 09 Aug 2011 Posts: 14 Location: India
|
|
|
|
Hi,
Below is my requirement:
Input File:
Code: |
Key Number
A 2
A 11
A 22
B 23
B 21 |
The Value of the field "Number" can be max of 100
Desired Output:
Code: |
A 484 (product of all values under "A" in input 2*11*22)
B 483 (product of all values under "B" in input 23*21) |
Please can you help me with this?
Data corrected |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
How many records do you expect to be coming for a "Key" ? |
|
Back to top |
|
|
Saravana Manikandan
New User
Joined: 09 Aug 2011 Posts: 14 Location: India
|
|
|
|
Each key can have a max of 31 entries |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
So max of 1.e+62 ??? |
|
Back to top |
|
|
Saravana Manikandan
New User
Joined: 09 Aug 2011 Posts: 14 Location: India
|
|
|
|
Hi Pandora,
Sorry about the confusion. I should have given the inputs correctly, my bad.
We are actually trying to acheive this formula:
(1+r1)*(1+r2)*(1+r3)...(1+rn) - 1
where 1<n<31 & -0.1<r<+0.1
So to answer your question each value will range between "-1.1 to +1.1" and max of 31 entries. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Can you re-post representative data with expected outputs.
23*21 is not 483.
You do know that SORT truncates from multiplication/dvision? |
|
Back to top |
|
|
Saravana Manikandan
New User
Joined: 09 Aug 2011 Posts: 14 Location: India
|
|
|
|
Hi Bill,
Reposting with the representative data:
Input:
Code: |
Key Number
A 0.20
A 0.11
A 0.22
B 0.23
B 0.21 |
The max number of occurrences for a particular "Key" can be 31
The value of "Number" ranges from -1 to +1
Desired output:
(1+r1)*(1+r2)*(1+r3)...(1+rn) - 1
Code: |
A 0.63 --> [(1+0.2)*(1+0.11)*(1+0.22) - 1]
B 0.49 --> [(1+0.23)*(1+0.21) - 1] |
|
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Bill Woodger wrote: |
23*21 is not 483 |
Is some non-standard notation being used? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
To me this could be handled much simpler way in Application program |
|
Back to top |
|
|
Saravana Manikandan
New User
Joined: 09 Aug 2011 Posts: 14 Location: India
|
|
|
|
Hi Pandora-Box,
That was my obvious answer! My manager for some weird reason wants this done in a sort card! |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Might your manager be able to provide some guidance?
Keep in mind if someone does come up with a complicated solution, your manager will be stuck with maintaining it. It is not likely you will be in that job forever. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Akatsukami wrote: |
Bill Woodger wrote: |
23*21 is not 483 |
Is some non-standard notation being used? |
Mmmm... my caluclator strongly disagrees with me. I bow to superior knowledge and experience :-) |
|
Back to top |
|
|
|