Sorry for the long delay responding. You can do this with a user-defined
function:
Public Function ThresholdDate(Rng As Range, Threshold As Double) As Date
Dim c As Range, tmpDate As Date
Dim RunTtl As Double
RunTtl = 0
For Each c In Rng
RunTtl = RunTtl + c.Value
If RunTtl > Threshold Then
tmpDate = c.Offset(0, -1).Value
Exit For
End If
Next c
ThresholdDate = tmpDate
End Function
The first argument, Rng, is the collection of percentages in column B on the
Data sheet. The second argument, Threshold, is the cumulative percentage
which, when exceeded, indicates the desired point in the data has been
reached. If the threshold is never attained, the formula returns 0. You would
call it from the Main sheet like this:
=ThresholdDate(Data!B1:B2000,125%) or
=ThresholdDate(Data!B1:B2000,1.25)
Since it returns a serial date value (from column A on the Data sheet), you
will need to format the cell with the formula to look like a date. You could
point the Threshold argument to a cell, so you could change the threshold
argument by changing that cell:
=ThresholdDate(Data!B1:B2000,H1)
where H1 contains 125%.
If you are new to user-defined functions (macros), this link to Jon
Peltier's site may be helpful:
http://peltiertech.com/WordPress/200...e-elses-macro/
Hope this helps,
Hutch
"blixel" wrote:
> On Jun 20, 12:34 pm, Tom Hutchins
> <TomHutch...@discussions.microsoft.com> wrote:
> > An Excel function can't put a value inanothercell; it just returns a value
> > to thecellthat contains theformula. I think the following arrayformulain
> > D1 will do what you want:
> >
> > =INDIRECT(ADDRESS(MATCH(1,IF(B1:B2000>100,1,0),0),1))
> >
> > This is an arrayformula. Hit ctrl-shift-enter instead of enter. If you do
> > it
> > correctly, excel will wrap curly brackets {} around yourformula. (don't type
> > them yourself.)
> >
> > Hope this helps,
> >
>
> Thanks for the reply Tom. That did give some an additional insight
> and I played around with a variety of ideas but still can't quite put
> it together. I'll further explain what I'm trying to do and maybe you
> or someone else can help bring it home for me.
>
> I have a 1 file spreadsheet that has two sheets. The first sheet is
> called "Main" and the second sheet is called "Data"
>
> The Main sheet is intended to be an easily readable summary of the
> Data sheet. The Data sheet contains 10 columns of data. In column A,
> it's the date starting in cell A1 with a date that is equal to a cell
> defined on the Main sheet. Then A2 and on done is simply A1+1, +A2+1,
> A3+1, and so on. Very simple but it goes on for more than 2,000 rows.
>
> The next important column for the sake of this problem is the %
> column. The % column is calculated at 1.3% on a weekday (Monday
> through Friday), and a lower percent on the weekend. I figured out
> how to easily do this by doing if(mod(weekday(A1),
> 7)<=1,.005,.013)) ... so if it is a Monday-Friday, the day is
> calculated at the higher percentage of 1.3%, if it's Saturday/Sunday,
> the day is calculated at 0.05%
>
> I keep track of this column on a daily basis which is just a simple
> =sum($C$1:C2) for day two, and =sum($C$1:C3) for day two and so on all
> the way down the line. Here is the "trick" ... when the sum of
> column C becomes equal or greater than 125%, I need to know the exact
> date that occurs on.
>
> So on my Main sheet, in the proper summary cell, I need something like
> =indirect(address(if(match($C$1:C2000>=125%)[return matching A column
> date on that day])))
>
> As a simple example, suppose the following. I'm using larger numbers
> to keep the example short.
>
> A1 = July 1, 2008 C1 = 25%
> A2 = July 2, 2008 C2 = 25%
> A3 = July 3, 2008 C3 = 25%
> A4 = July 4, 2008 C4 = 15%
> A6 = July 6, 2008 C4 = 15%
> A7 = July 7, 2008 C4 = 25%
> A8 = July 8, 2008 C4 = 25%
>
> On July 7th, 2008 the total percentage will go to 130% which is over
> the requirement. So I need the cell on the Main sheet to pull that
> date from A7. Bear in mind that the date for A1 will change depending
> on the situation. It's not hard coded. A1 could be any date.
>
>