Stumped on a simple formula. Need help

mdean32

New Member
Joined
Jan 15, 2019
Messages
22
What formula could I use that would locate the first numeric value for Part A,B,C, and then give the correct date in which the first numeric value was located? Example, if I wanted to know the due date of Part C, how would I get the formula to return 4/22? Part B to return 4/20? etc Thank you in advance


Part4/184/194/204/214/22
A2
B3
C5
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
One way,

Book1
ABCDEFGHI
1apr/18apr/19apr/20apr/21apr/22Date
2A2apr/19
3B3apr/20
4C5apr/22
Sheet1
Cell Formulas
RangeFormula
I2:I4I2=INDEX($B$1:$F$1,MATCH(9.9^99,B2:F2))
 
Upvote 0
Awesome that worked. One thing I left out. If I have numbers on different dates for the same part, the formula returns the value of the last date. How can I make it return the first date? Example
I need Part A to return the date of the first numeric value which would be 4/18. Thank you so much for your help
Part4/184/194/20
A253
 
Upvote 0
Another way, assuming only one numeric value per part.
Book1
ABCDEFG
1Part18-Apr19-Apr20-Apr21-Apr22-AprDue Date
2A219-Apr
3B320-Apr
4C522-Apr
Sheet2
Cell Formulas
RangeFormula
G2:G4G2=INDEX($A$1:$F$4,1,MATCH(SUM($A2:$F2),$A2:$F2,0))
 
Upvote 0
Perhaps like so
Book1
ABCDEFGHI
1Partapr/18apr/19apr/20apr/21apr/22
2A12apr/18
3B53apr/19
4C275apr/20
Sheet1
Cell Formulas
RangeFormula
I2:I4I2=INDEX($B$1:$F$1,AGGREGATE(15,6,(COLUMN($B$1:$F$1)-1)/(B2:F2>0),1))
 
Upvote 0
GraH I can't get your last formula to work in a big data set. You're first formula gets me exactly what I need other than giving the last date of a numeric value instead of returning the first date of a numeric value. Thanks for all the help
 
Upvote 0
This formula worked great , except on row 4 and 6 it returned the date for the last value in the row instead of the date for the first value.


I2:I4I2=INDEX($B$1:$F$1,MATCH(9.9^99,B2:F2))



MaterialOH InvPast Due8-Apr9-Apr10-Apr11-Apr12-Apr13-Apr14-Apr15-Apr16-Apr17-Apr18-Apr19-Apr20-Apr21-Apr22-Aprpdnext 5Due Date
119825083M060 600Past Due
KE22207645M0 40 4004/12
116600122002M09 18 2704/10
116600122008M-23 23 0234/13
116600122011M23 477 500 4775004/15
 
Upvote 0
This formula worked great , except on row 4 and 6 it returned the date for the last value in the row instead of the date for the first value.


I2:I4I2=INDEX($B$1:$F$1,MATCH(9.9^99,B2:F2))



MaterialOH InvPast Due8-Apr9-Apr10-Apr11-Apr12-Apr13-Apr14-Apr15-Apr16-Apr17-Apr18-Apr19-Apr20-Apr21-Apr22-Aprpdnext 5Due Date
119825083M060 600Past Due
KE22207645M0 40 4004/12
116600122002M09 18 2704/10
116600122008M-23 23 0234/13
116600122011M23 477 500 4775004/15
So I assume there is no way to always get the first numerical value in a row instead of the last for the above spreadsheet?
 
Upvote 0
Hi mdean,

you could create a new function in VBA to do the work for you.

Put the following code into a standard module
VBA Code:
Function duedate(target As Range)
  R = target.Row
  firstC = 3
  lastC = target.Column - 3
  For C = firstC To lastC
    If Cells(R, C) <> "" Then
      duedate = Cells(1, C)
      Exit For
    End If
  Next
End Function

and call it from the cell.

ie under "Due Date" in cell U2 put =duedate(u2)

hope that works for you.
 
Upvote 0
or, if you don't want to use VBA
you could put the formula in U2:
=INDEX($C$1:$R$1,MATCH(TRUE,INDEX((C2:R2<>0),0),0))

That might work also.
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

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