index return last value horizontally

King_Louie

New Member
Joined
Dec 7, 2019
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have a s/s that tracks the status of a product as it moves along the manufacturing process. I'm trying to find an array formula that retrieves data from the last column containing data so I can see the current status of that product. Any ideas?

Thanks
 

Attachments

  • Example.gif
    Example.gif
    9 KB · Views: 16
Try these. Assumes at least one status entry per row.

Book1
ABCDEFGHIJKLM
1Car #Status #1 DateStatus # 1 AreaStatus # 1 CommentStatus #2 DateStatus # 2 AreaStatus # 2 CommentStatus #3 DateStatus # 3 AreaStatus # 3 CommentCurrent Status DateCurrent Status AreaCurrent Status Comment
2AA111/10/2019assembly15/10/2019paintblue25/10/2019QC25/10/2019QC 
3BB221/10/2019assemblybroken light15/10/2019paintred15/10/2019paintred
4CC331/10/2019assembly1/10/2019assembly 
Status
Cell Formulas
RangeFormula
K2:K4K2=LOOKUP(9.99E+307,B2:J2)
L2:L4L2=INDEX(B2:J2,AGGREGATE(14,6,(COLUMN(B2:J2)-COLUMN(B2)+1)/(B2:J2=K2),1)+1)&""
M2:M4M2=INDEX(B2:J2,AGGREGATE(14,6,(COLUMN(B2:J2)-COLUMN(B2)+1)/(B2:J2=K2),1)+2)&""
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try these. Assumes at least one status entry per row.

Book1
ABCDEFGHIJKLM
1Car #Status #1 DateStatus # 1 AreaStatus # 1 CommentStatus #2 DateStatus # 2 AreaStatus # 2 CommentStatus #3 DateStatus # 3 AreaStatus # 3 CommentCurrent Status DateCurrent Status AreaCurrent Status Comment
2AA111/10/2019assembly15/10/2019paintblue25/10/2019QC25/10/2019QC 
3BB221/10/2019assemblybroken light15/10/2019paintred15/10/2019paintred
4CC331/10/2019assembly1/10/2019assembly 
Status
Cell Formulas
RangeFormula
K2:K4K2=LOOKUP(9.99E+307,B2:J2)
L2:L4L2=INDEX(B2:J2,AGGREGATE(14,6,(COLUMN(B2:J2)-COLUMN(B2)+1)/(B2:J2=K2),1)+1)&""
M2:M4M2=INDEX(B2:J2,AGGREGATE(14,6,(COLUMN(B2:J2)-COLUMN(B2)+1)/(B2:J2=K2),1)+2)&""

Thanks!

=LOOKUP(9.99E+307,B2:J2) -- Looks up the largest value in selected range?

Can you briefly describe how second function works? Can it be modified to pull the "Current Status Date" too?
 
Upvote 0
=LOOKUP(9.99E+307,B2:J2) -- Looks up the largest value in selected range?
No, as explained by others earlier in the thread, this structure returns the last (ie furthest to the right) numeric value in the range. In your case, judging by your sample data, this will be the date of the latest (ie furthest to the right) status.

Do your status column groups get filled left to right? It appears that way from your samples.

Can you briefly describe how second function works? Can it be modified to pull the "Current Status Date" too?
I'm not sure what you are actually asking here. In what way do the results in K2:M4 of my worksheet above, not meet what you want?
 
Upvote 0
I want to return all data/text from the recent section group. For example, in the current grouping columns (K,L,&M) for Car #AA11, the formulas should return "10/25/2019", "QC", & "(Blank)".

Are the values in K, L, and M desired values or user-entered values?
 
Upvote 0
No, as explained by others earlier in the thread, this structure returns the last (ie furthest to the right) numeric value in the range. In your case, judging by your sample data, this will be the date of the latest (ie furthest to the right) status.

Do your status column groups get filled left to right? It appears that way from your samples.
Yes currently they get filled in left to right

I'm not sure what you are actually asking here. In what way do the results in K2:M4 of my worksheet above, not meet what you want?

Looking to understand how the second formula is computed and why it's not used for Column K (which might be answered in formula explanation).
 
Upvote 0
Looking to understand how the second formula is computed and why it's not used for Column K (which might be answered in formula explanation).
OK, my formulas go in columns K:M and get their returned values by looking in columns B:J

The second formula is
=INDEX(B2:J2,AGGREGATE(14,6,(COLUMN(B2:J2)-COLUMN(B2)+1)/(B2:J2=K2),1)+1)&""

The blue part makes an array of numbers, counting the columns in B:J as follows
{2;3;4;5;6;7;8;9;10} - 2 +1
giving {1;2;3;4;5;6;7;8;9}

=INDEX(B2:J2,AGGREGATE(14,6,{1;2;3;4;5;6;7;8;9}/(B2:J2=K2),1)+1)&""
Blue part makes an array of True/False values depending on whether B2:K2 is the same as the value in K2
{F;F;F;F;F;F;T;F;F}

=INDEX(B2:J2,AGGREGATE(14,6,{1;2;3;4;5;6;7;8;9}/{F;F;F;F;F;F;T;F;F},1)+1)&""
Blue part divides the corresponding values. To do this Excel converts True to 1, False to 0
{#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;7;#DIV/0!;#DIV/0!}

=INDEX(B2:J2,AGGREGATE(14,6,{#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;7;#DIV/0!;#DIV/0!},1)+1)&""
AGGREGATE(15,6,....,1) looks for the largest value in the array, ignoring errors
7

=INDEX(B2:J2,7+1)&""
=INDEX(B2:J2,8)&""
=Cell I2
="QC"

The 3rd formula is identical except that it adds 2 instead of 1 where I have highlighted red above, thus returning the value from 2 cells to the right of the last date.
The &"" on the end of each formula is so the formula returns "" not 0 if the target cell is empty.

This form of formula cannot be used for column K because it uses the value in column K so would produce a circular reference.
In any case there is a much simpler formula already for column K.

I hope that I haven't misunderstood your question and the above helps.
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

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