Lookup last entry on a row referencing every second column

ozbeachbum

Board Regular
Joined
Jun 3, 2015
Messages
235
Office Version
  1. 2021
Platform
  1. Windows
I am trying to return the last entry in a row, but only referencing every second column.

Destination Cell AG76 Tue 02-Jul-41 17:30
Reference Cells NO76 Mon 01-Jul-41 12:00 NP $10.00 NQ76 Tue 02-Jul-41 17:30 NR $10.50
Any assistance greatly appreciated.
240905 20 CHRONICLE lup2ndc.xlsx
AGAHAIAJAKNMNNNONPNQNR
74Lookup every second column starting at "NO"
75
76Tue 02-Jul-41 17:30Mon 01-Jul-41 12:00$ 10.00Tue 02-Jul-41 17:30$ 10.50
Blank
 

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
Does this work for your situation?
Change the 'NZ' column reference to wherever you need it to extend to.
Excel Formula:
=IF(MOD(COLUMN(INDIRECT(CELL("address",INDEX(NO76:NZ76,1,COUNTA(NO76:NZ76))))),2)=1,INDEX(NO76:NZ76,1,COUNTA(NO76:NZ76)),INDEX(NN76:NZ76,1,COUNTA(NN76:NZ76)))
 
Upvote 0
Thanks again Murray,
Worked perfectly, just had to add the following to eliminate SPILL on blank rows.

=INDEX(IF(MOD(COLUMN(INDIRECT(CELL("address",INDEX(NO76:NZ76,1,COUNTA(NO76:NZ76))))),2)=1,INDEX(NO76:NZ76,1,COUNTA(NO76:NZ76)),INDEX(NN76:NZ76,1,COUNTA(NN76:NZ76))),1)

Cheers,
Dave.
 
Upvote 0
You have not given us a lot of information about the rest of the relevant data columns but I would be fairly surprised if it could not be done much shorter and without all those volatile functions (CELL, INDIRECT) in there.

Some possibilities, but there may be others depending on just what might happen in those columns.

If there are headings somewhere in those date columns and there is anything in those headings to identify the date columns (or the Amount columns). For example, if all the date columns had a heading of "Date" in row 1 and any dates across the data row are increasing like your one example (several examples usually helps more ;))
Excel Formula:
=MAXIFS(NO76:NZ76,NO1:NZ1,"Date")

Same as above but the data row dates may not be increasing
Excel Formula:
=LET(r,NO76:NZ76,f,FILTER(r,(NO1:NZ1="Date")*(r<>""),NA()),IFNA(INDEX(f,COLUMNS(f)),0))

If the Date/Amount values always come in pairs (whether or not there are headings)
Excel Formula:
=IFNA(LOOKUP(9^9,NO76:NZ76,NN76:NY76),0)

No ifs
Excel Formula:
=IFNA(LOOKUP(9^9,INDEX(NO76:NZ76,SEQUENCE(,COLUMNS(NO76:NZ76)/2,,2))),0)
 
Last edited:
Upvote 0
Solution
You have not given us a lot of information about the rest of the relevant data columns but I would be fairly surprised if it could not be done much shorter and without all those volatile functions (CELL, INDIRECT) in there.

Some possibilities, but there may be others depending on just what might happen in those columns.

If there are headings somewhere in those date columns and there is anything in those headings to identify the date columns (or the Amount columns). For example, if all the date columns had a heading of "Date" in row 1 and any dates across the data row are increasing like your one example (several examples usually helps more ;))
Excel Formula:
=MAXIFS(NO76:NZ76,NO1:NZ1,"Date")

Same as above but the data row dates may not be increasing
Excel Formula:
=LET(r,NO76:NZ76,f,FILTER(r,(NO1:NZ1="Date")*(r<>""),NA()),IFNA(INDEX(f,COLUMNS(f)),0))

If the Date/Amount values always come in pairs (whether or not there are headings)
Excel Formula:
=IFNA(LOOKUP(9^9,NO76:NZ76,NN76:NY76),0)

No ifs
Excel Formula:
=IFNA(LOOKUP(9^9,INDEX(NO76:NZ76,SEQUENCE(,COLUMNS(NO76:NZ76)/2,,2))),0)
Thanks Peter,
Take your point re examples, and will do better in the future.
I have gone with MAXIFS(NO76:NZ76,NO1:NZ1,"Date") as I also need to bring in the $ value on the same row, so using the header works well.
Your knowledge is amazing.
Cheers,
Dave.
 
Upvote 0
If the date & amount always come in pairs then for amount all you should need is
Excel Formula:
=IFNA(LOOKUP(9^9,NO76:NZ76),0)
 
Upvote 0

Forum statistics

Threads
1,224,084
Messages
6,176,272
Members
452,718
Latest member
Nyxs_Inquisitor

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