View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Return value based on fraction of a list - VBA

I still don't get it... I do not see any pattern connections between the
values in Columns P and U and a value of 1 in Q4.

--
Rick (MVP - Excel)


"JLGWhiz" wrote in message
...
Rick, I read that two or three times before I finally decided he is using
Q4
value as a divisor for the value in col P. But I could be wrong.

"Rick Rothstein" wrote:

I'm afraid I am not following your example. Why are the numbers in column
P
a 1, 2, etc. if there is a 1 in Q4? You said the number in Q4 divides the
list in Column U into more-or-less equal sections/fractions... how does a
1
divide a group into multiple sections?

--
Rick (MVP - Excel)


wrote in message
...
Hi all,
I posted this in excel.functions 29th Dec, but there have been no
replies. Assuming that it IS a VBA problem, can someone in this group
help me please?

"In $U$8:Ux I have a variable length list of sizes. In $Q$4 I have a
number (1, 2, 4, 8, etc), that is used to divide $U$8:Ux into more-
or-
less equal sections/fractions. In $P$8:Px I need to return a set of
values (1 - Q4) that reflects the fractions in $U$8:Ux (ie they would
be the numerator of the fractions). Eg:

P U
1 23
1 16
1 1.5
1 85.6
1 23.4
1 12.8
2 45
2 23.6
2 56
2 105.1
etc

So far this formula is getting there, but I can't work out how to
finish it such that it accommodates ANY value in Q4.


=IF(SUM($U$8:U8)<SUM($U$8:$U$75)/$Q$4,1,IF(SUM($U8:U$26)<SUM($U$26:$U
$75)/$Q$4-1,2,IF(SUM($U8:U$26)<SUM($U$26:$U$75)/$Q$4-2,3,"Other
values
that I can't work out")))


Can anyone help? Preferably a formula but VBA would be good too.
Don't
worry about the SUM($U$26:$U$75) bit: I can make that take the column
length into account.
thanks,
Philip "