Argggg! I have no clue how to figure out this equation writing puzzle... it isn't so much the syntax, as a way of thinking about the problem.figuring

fishoutofwater

New Member
Joined
Jul 20, 2011
Messages
38
Hey gurus and geniuses... much obliged if you can help me on this stumper... it should be easy, but I am cracking my head against the keyboard trying to crack it, to no avail... first, I'll show you the data...

0
50
2
60
5
70
4
80
3
90
4
100
6
110
2
120
3
130
1
140

<tbody>
</tbody>

OK, let's call the left column "score" and the right column "value" and the highest "score" the "peak" (In the example the "peak" is the 6 in row 7 . What I want to do is figure out the values in the 2nd column associated with the 70% interval around the peak. In other words, the logic looks like this...

STEP 1: Figure out the sum of Scores {ie. sum of column A = 30}
STEP 2: Figure out 70% of sum of Scores {ie. (=70%*sum(colA)) = 21}
STEP 3: Here is where it gets tricky....
(a) START AT THE PEAK... We have 6 (the green value) so add it TEST (the first time the TEST=PEAK)
(b) CHECK TO SEE IF WE have exceeded the STEP 2 Value, if not continue... if so END
CHECK the value one above and one below the current included Range (ie. compare the red numbers the 4 and the 2)
ADD the bigger number to our TEST (so 6+4) = 10​
(c) If our TOTAL TEST SUM is still less than the 70%, check the 2 new numbers at the edge of the range. Now it will be the red 2 and the purple 3. Add the bigger number (the 3) to our TEST value, and check if our current total test (now at 13) is more than 70%, if not, continue.
(d) Compare the two numbers at the edge of the range (Now that is the red 2 and the orange 4) Add the bigger number to our test. That would be the 4. Now we are up to 17. 17 is still less than 21 (the 70%) so we do it again...
(e) Test the red 2 (at the lower edge of our range still) and the pink 5. The pink 5 is bigger, so we add it to our test. Now our test is 22. Since 22 is bigger than the 70% value (21) we stop and we have identified a range. This range is marked by the Red numbers in column 2.
STEP 4: THE REAL GOAL!!!! I want to know the top of the range (in column 2) and the bottom of the range (in column 2)... so my answer would be in two cells, the first cell = 70; the 2nd cell = 110, representing that 70% of the distribution around the peak value in column 1 is inside the range of 70 to 110.

I have tried adding helper columns, and I have smoke coming out of my ears from my brain cells catching fire, and I just have to admit defeat... I have no clue how to approach this...
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi, I did try this and have managed to get it to work.

However, it does not feel finished.

Beware, not all the formulas copy down. Some have different formulas in different rows.

Your supplied data starts at A13. That is linked to the use of ROW(A12) elsewhere in the worksheet. So if you change that there will be other things to change.

The first cells under Top Row and Bottom Row are calculated using a MATCH statement in F10.
Subsequent row numbers are calculated, initially by incrementing by +/- 1 and later using an IF to find the number actually used.

Columns labeled Top and Bottom show the next two possible numbers to pick.

Row is the row where the data came from.

Max highlights the number to use in the sum.

The Total is worked out in A10 and 70% is displayed in the 70% column.

The decision to include the figure is listed in the Include column.

The High Row and Low Rows are itemised in M and N based on Max.

The High Val and Low val uses those rows and an OFFSET function to list the max and min figures.


I think, if it were me, I would prefer to use a macro!


Cell Formulas
RangeFormula
A10=SUM(A13:A22)
F10=MATCH(MAX(A13:A22),A13:A22,0)
F14=MAX(A13:A22)
F15=OFFSET($A$1,D15-1,0,1,1)
F16=OFFSET($A$1,D16-1,0,1,1)
F17=OFFSET($A$1,D17-1,0,1,1)
F18=OFFSET($A$1,D18-1,0,1,1)
F19=OFFSET($A$1,D19-1,0,1,1)
F20=OFFSET($A$1,D20-1,0,1,1)
F21=OFFSET($A$1,D21-1,0,1,1)
F22=OFFSET($A$1,D22-1,0,1,1)
F23=OFFSET($A$1,D23-1,0,1,1)
F24=OFFSET($A$1,D24-1,0,1,1)
F25=OFFSET($A$1,D25-1,0,1,1)
F26=OFFSET($A$1,D26-1,0,1,1)
F27=OFFSET($A$1,D27-1,0,1,1)
F28=OFFSET($A$1,D28-1,0,1,1)
F29=OFFSET($A$1,D29-1,0,1,1)
F30=OFFSET($A$1,D30-1,0,1,1)
F31=OFFSET($A$1,D31-1,0,1,1)
O14=OFFSET(A1,M14-1,1,1,1)
P14=OFFSET(A1,N14-1,1,1,1)
D14=ROW(A12)+F10
D15=D14-1
D16=IF(F15>G15,D15-1,D15)
D17=IF(F16>G16,D16-1,D16)
D18=IF(F17>G17,D17-1,D17)
D19=IF(F18>G18,D18-1,D18)
D20=IF(F19>G19,D19-1,D19)
D21=IF(F20>G20,D20-1,D20)
D22=IF(F21>G21,D21-1,D21)
D23=IF(F22>G22,D22-1,D22)
D24=IF(F23>G23,D23-1,D23)
D25=IF(F24>G24,D24-1,D24)
D26=IF(F25>G25,D25-1,D25)
D27=IF(F26>G26,D26-1,D26)
D28=IF(F27>G27,D27-1,D27)
D29=IF(F28>G28,D28-1,D28)
D30=IF(F29>G29,D29-1,D29)
D31=IF(F30>G30,D30-1,D30)
E14=ROW(A12)+F10
E15=E14+1
E16=IF(F15>G15,E15,E15+1)
E17=IF(F16>G16,E16,E16+1)
E18=IF(F17>G17,E17,E17+1)
E19=IF(F18>G18,E18,E18+1)
E20=IF(F19>G19,E19,E19+1)
E21=IF(F20>G20,E20,E20+1)
E22=IF(F21>G21,E21,E21+1)
E23=IF(F22>G22,E22,E22+1)
E24=IF(F23>G23,E23,E23+1)
E25=IF(F24>G24,E24,E24+1)
E26=IF(F25>G25,E25,E25+1)
E27=IF(F26>G26,E26,E26+1)
E28=IF(F27>G27,E27,E27+1)
E29=IF(F28>G28,E28,E28+1)
E30=IF(F29>G29,E29,E29+1)
E31=IF(F30>G30,E30,E30+1)
G14=MAX(A13:A22)
G15=OFFSET($A$1,E15-1,0,1,1)
G16=OFFSET($A$1,E16-1,0,1,1)
G17=OFFSET($A$1,E17-1,0,1,1)
G18=OFFSET($A$1,E18-1,0,1,1)
G19=OFFSET($A$1,E19-1,0,1,1)
G20=OFFSET($A$1,E20-1,0,1,1)
G21=OFFSET($A$1,E21-1,0,1,1)
G22=OFFSET($A$1,E22-1,0,1,1)
G23=OFFSET($A$1,E23-1,0,1,1)
G24=OFFSET($A$1,E24-1,0,1,1)
G25=OFFSET($A$1,E25-1,0,1,1)
G26=OFFSET($A$1,E26-1,0,1,1)
G27=OFFSET($A$1,E27-1,0,1,1)
G28=OFFSET($A$1,E28-1,0,1,1)
G29=OFFSET($A$1,E29-1,0,1,1)
G30=OFFSET($A$1,E30-1,0,1,1)
G31=OFFSET($A$1,E31-1,0,1,1)
H14=IF(F14>G14,D14,E14)
H15=IF(F15>G15,D15,E15)
H16=IF(F16>G16,D16,E16)
H17=IF(F17>G17,D17,E17)
H18=IF(F18>G18,D18,E18)
H19=IF(F19>G19,D19,E19)
H20=IF(F20>G20,D20,E20)
H21=IF(F21>G21,D21,E21)
H22=IF(F22>G22,D22,E22)
H23=IF(F23>G23,D23,E23)
H24=IF(F24>G24,D24,E24)
H25=IF(F25>G25,D25,E25)
H26=IF(F26>G26,D26,E26)
H27=IF(F27>G27,D27,E27)
H28=IF(F28>G28,D28,E28)
H29=IF(F29>G29,D29,E29)
H30=IF(F30>G30,D30,E30)
H31=IF(F31>G31,D31,E31)
I14=MAX(F14:G14)
I15=MAX(F15:G15)
I16=MAX(F16:G16)
I17=MAX(F17:G17)
I18=MAX(F18:G18)
I19=MAX(F19:G19)
I20=MAX(F20:G20)
I21=MAX(F21:G21)
I22=MAX(F22:G22)
I23=MAX(F23:G23)
I24=MAX(F24:G24)
I25=MAX(F25:G25)
I26=MAX(F26:G26)
I27=MAX(F27:G27)
I28=MAX(F28:G28)
I29=MAX(F29:G29)
I30=MAX(F30:G30)
I31=MAX(F31:G31)
J14=SUM($I$14:I14)
J15=SUM($I$14:I15)
J16=SUM($I$14:I16)
J17=SUM($I$14:I17)
J18=SUM($I$14:I18)
J19=SUM($I$14:I19)
J20=SUM($I$14:I20)
J21=SUM($I$14:I21)
J22=SUM($I$14:I22)
J23=SUM($I$14:I23)
J24=SUM($I$14:I24)
J25=SUM($I$14:I25)
J26=SUM($I$14:I26)
J27=SUM($I$14:I27)
J28=SUM($I$14:I28)
J29=SUM($I$14:I29)
J30=SUM($I$14:I30)
J31=SUM($I$14:I31)
K14=$K$13*$A$10
K15=$K$13*$A$10
K16=$K$13*$A$10
K17=$K$13*$A$10
K18=$K$13*$A$10
K19=$K$13*$A$10
K20=$K$13*$A$10
K21=$K$13*$A$10
K22=$K$13*$A$10
K23=$K$13*$A$10
K24=$K$13*$A$10
K25=$K$13*$A$10
K26=$K$13*$A$10
K27=$K$13*$A$10
K28=$K$13*$A$10
K29=$K$13*$A$10
K30=$K$13*$A$10
K31=$K$13*$A$10
L14=IF(OR(J13="SUM",J13),TRUE,FALSE)
L15=IF(OR(J14="SUM",J14),TRUE,FALSE)
L16=IF(OR(J15="SUM",J15),TRUE,FALSE)
L17=IF(OR(J16="SUM",J16),TRUE,FALSE)
L18=IF(OR(J17="SUM",J17),TRUE,FALSE)
L19=IF(OR(J18="SUM",J18),TRUE,FALSE)
L20=IF(OR(J19="SUM",J19),TRUE,FALSE)
L21=IF(OR(J20="SUM",J20),TRUE,FALSE)
L22=IF(OR(J21="SUM",J21),TRUE,FALSE)
L23=IF(OR(J22="SUM",J22),TRUE,FALSE)
L24=IF(OR(J23="SUM",J23),TRUE,FALSE)
L25=IF(OR(J24="SUM",J24),TRUE,FALSE)
L26=IF(OR(J25="SUM",J25),TRUE,FALSE)
L27=IF(OR(J26="SUM",J26),TRUE,FALSE)
L28=IF(OR(J27="SUM",J27),TRUE,FALSE)
L29=IF(OR(J28="SUM",J28),TRUE,FALSE)
L30=IF(OR(J29="SUM",J29),TRUE,FALSE)
L31=IF(OR(J30="SUM",J30),TRUE,FALSE)
M14{=MIN(IF(L14:L31,H14:H31))}
N14{=MAX(IF(L14:L31,H14:H31))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Wow! Thank you so much! What an immense amount of effort you put in to helping me... I am deepy appreciative... I am going to try this over the weekend... Thanks again!
 
Upvote 0
Hi,

No problem - I like a puzzle. :)

It will cope with different numbers to an extent but is not as "smooth" as I would like so I nearly didn't post it.

Incidentally, the method you describe can be ambiguous. Consider: 5, 2, 3, 4, 2, 9, 2, 8, 7, 6, 5. Depending on which 2 is chosen after the 9 will decide which numbers are used.

Anyway, have fun!
 
Upvote 0

Forum statistics

Threads
1,215,034
Messages
6,122,782
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top