Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Find First Negative Number after 'X' has been reached

Great site, i have an excel challenge and I haven't found a solution yet.

Here it is, any insight would be greatly appreciated.

http://screencast.com/t/1mxOcUoOqhlD

I have 8 cells in columns A-H in Row 3. their contents are

-5, 5, -2, 4, -2, 10, 4, 11

in Cell K1 = 3

I need a formula that will tell me which position in Row 3; where after the value in K1 has been exceeded, I need the position of the next time i have a value of less than or equal to "Zero". Looking at the data, the answer should be "3", but I am having a hard time using "Match" and "Index" and "ISNA" formulas that are not working.

Basically, 3 is exceeded by the second number (5), I want the next time a number is <1 after the 5 ie -2 the third number, so the answer should be "3".


Any insight would be Greatly Appreciated.

thanks in advance.


Will
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default Find First Negative Number after 'X' has been reached

The best I can figure right at this moment is to copy this formula into column M, and then copy past column M through column T:
=IF(A3=$K$3,COLUMN(A3),"")

Then in column V paste this formula:
=INDEX(A3:H3,1,MIN(M3:T3)+1)

That returns the correct answer but requires the use of those additional columns. I'm still thinking on a more elegant solution.
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default Find First Negative Number after 'X' has been reached

Hi,

Am Fri, 5 Sep 2014 19:01:49 +0100 schrieb dwg1803:

-5, 5, -2, 4, -2, 10, 4, 11

in Cell K1 = 3

I need a formula that will tell me which position in Row 3; where after
the value in K1 has been exceeded, I need the position of the next time
i have a value of less than or equal to "Zero"


copy following code in a standard module and call the function in the
worksheet in row 3 with
=myCol()

Function myCol() As Long
Dim i As Long
Dim myRow As Long

myRow = Application.Caller.Row
For i = 1 To 8
If Cells(myRow, i) = Range("K1") And _
Cells(myRow, i + 1) <= 0 Then
myCol = i + 1
Exit For
End If
Next
End Function


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default Find First Negative Number after 'X' has been reached

Hi again,

Am Mon, 8 Sep 2014 17:22:09 +0200 schrieb Claus Busch:

copy following code in a standard module and call the function in the
worksheet in row 3 with
=myCol()


there is an error in the last answer.
Try following code:

Function myCol() As Variant
Dim i As Long
Dim myRow As Long
Dim myFlag As Boolean

Application.Volatile
myRow = Application.Caller.Row
For i = 1 To 8
If Cells(myRow, i) = Range("K1") Then
myFlag = True
End If
If myFlag = True And Cells(myRow, i + 1) <= 0 Then
myCol = i + 1
Exit For
End If
Next
myCol = IIf(myCol 8, "NA", myCol)
End Function


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default Find First Negative Number after 'X' has been reached

Disregard my response: I realized it does not fulfill the requirements.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula Help: When a Number is Reached morri3sa New Users to Excel 2 November 9th 10 11:34 PM
How can you make the Find function stop when it reached the end kikilein Excel Discussion (Misc queries) 1 February 3rd 07 02:50 PM
Adding a certain number until minimum is reached dk Excel Discussion (Misc queries) 3 December 7th 05 01:29 AM
Find a negative number in a range Scott at Culvers Excel Worksheet Functions 1 November 22nd 05 04:55 PM
2003= negative number&2004= negative number How Do I Calculate gro Jason Excel Worksheet Functions 1 January 14th 05 05:24 PM


All times are GMT +1. The time now is 11:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"