Finding latest value in multiple columns that meets criteria and is bigger than 0

Okoth

Board Regular
Joined
Sep 10, 2009
Messages
106
Office Version
  1. 2019
Platform
  1. Windows
Trying to figure this one out, but haven't succeeded yet.

I want to find the latest value in two columns (B and F) with some columns in between that match a criteria and the value must be bigger than 0.
Below, the criteria is B15 and the result should be 170 in cell D15.

Hope someone can help me with this, because the columns in between and the empty row are killing me.

ABCDEF
1A110111222A110
2B120112222C120
3C130113223B130
4A140114224C140
5B150115225A150
6
7C160116226B180
8A115117227C170
9B125118228A180
10C135119229B170
11A0120220C0
12B0121222B0
13C0122222A0
14
15LatestBis170

<tbody>
</tbody>
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi,

With latest I mean the last row (A or E) that has B as a value.

How I get 170 is also my question, but the latest (last row with) B value is cell F10.

Thanks for looking at it.
 
Upvote 0
What happens if the "latest" occurrence of "B" is the same in column B and column E? Do you take the value from column C or from column F?

Regards
 
Upvote 0
The example I used is a very simple version of the sheet I am using. The latest B (the last row where we can find B that has a value bigger than 0) will always be either in column B or E. Never the same row. You can compare it with the World Cup playing schedule. Brazil (column A) is the home country in the first match, it is the home country in the second, but it is the away country (column E) in the third match ;)
 
Upvote 0
Thanks.

If you're using Excel 2010 or later:

=INDIRECT(TEXT(AGGREGATE(14,6,(ROW(A1:F13)*10^6+1+COLUMN(A1:F13))/((A1:F13=B15)*(B1:G13<>0)),1),"R000000C000000"),0)

Otherwise, array formula**:

=INDIRECT(TEXT(MAX(IF(A1:F13=B15,IF(B1:G13<>0,ROW(A1:F13)*10^6+1+COLUMN(A1:F13)))),"R000000C000000"),0)


Regards


**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
</SPAN></SPAN>
 
Upvote 0
try the CSE formula
=INDEX(A1:F14,INT(MAX(($A$1:$E$13="b")*($B$1:$F$13<>0)*(ROW($A$1:$E$13)+COLUMN($B$1:$F$13)/100))), 100*MOD(MAX(($A$1:$E$13="b")*($B$1:$F$13<>0)*(ROW($A$1:$E$13)+COLUMN($B$1:$F$13)/100)), 1))
 
Upvote 0
This works perfectly. No wonder I couldn't find the answer myself, how do you come up with something like this :LOL:
 
Upvote 0
Thanks.

If you're using Excel 2010 or later:

=INDIRECT(TEXT(AGGREGATE(14,6,(ROW(A1:F13)*10^6+1+COLUMN(A1:F13))/((A1:F13=B15)*(B1:G13<>0)),1),"R000000C000000"),0)
Hi,

What do you mean with "R000000C000000"? Is this Row and Column? It gives an error on that point. I'm using Excel 2013.
 
Upvote 0
Hi,

What do you mean with "R000000C000000"? Is this Row and Column? It gives an error on that point. I'm using Excel 2013.

Does your system use the comma or semi-colon as argument separator in functions?

Regards
 
Upvote 0

Forum statistics

Threads
1,215,634
Messages
6,125,934
Members
449,275
Latest member
jacob_mcbride

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