How to use aggregate function to show first instance of value

jc352

Board Regular
Joined
Aug 13, 2008
Messages
139
Office Version
  1. 365
Platform
  1. Windows
ABCD
1NameDateDateDate
2Bill5-6-24
3George5-6-24
4Adam5-6-24

=AGGREGATE(15,6,COLUMN($B$2:$D$4)/(B$2:$D$4=DATE(2024,5,6)),ROWS($A$3:$A3))

This formula reports 2, 3 and 4 when pulled down. How do i get this formula to report 4, 2 and 3 in the order these dates are on the table?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Try:
Book1.xlsx
ABCDE
1NameDateDateDate
2Bill5/6/244
3George5/6/242
4Adam5/6/243
Sheet9
Cell Formulas
RangeFormula
E2:E4E2=TOCOL(IF(B2:D4=DATE(2024,5,6),COLUMN(B2:D4),NA()),3)
Dynamic array formulas.
 
Upvote 0
Thank you, that works great. However, I need to add it in as part of another formula and I am getting a spill error with it. Basically what I am trying to do is create a list on a calendar. If the date is in column B (1), column C (2) and column D (3). The return would be:

Bill (3)
George (1)
Adam (2)
 
Upvote 0
Is this what you mean?
Book1.xlsx
ABCDE
1NameDateDateDate
2Bill5/6/24Bill (3)
3George5/6/24George (1)
4Adam5/6/24Adam (2)
Sheet9
Cell Formulas
RangeFormula
E2:E4E2=A2:A4 & " (" & TOCOL(IF(B2:D4=DATE(2024,5,6),COLUMN(B2:D4),NA()),3)-1 & ")"
Dynamic array formulas.
 
Upvote 0
Another approach:
Excel Formula:
=MMULT(--(B2:D4=DATE(2024,5,6)),TRANSPOSE(COLUMN(B1:D1)-COLUMN(B1)+1))
 
Upvote 0
What i actually need it to do is be able to indicate the type of entitlement based on the column number the date is in. If it is in column B (PTO), column C (PH) and column D (DH).

Bill (DH)
George (PTO)
Adam (PH)

Both formulas indicate the column correctly, but won't allow me to incorporate them into existing formulas to accomplish this.
 
Upvote 0
Assuming you have "PTO", "PH", "DH" in range B1:D1
Excel Formula:
=INDEX(B1:D1,MMULT(--(B2:D4=DATE(2024,5,6)),TRANSPOSE(COLUMN(B1:D1)-COLUMN(B1)+1)))
 
Upvote 0
Book1.xlsx
ABCDE
1NameDateDateDate
2Bill5/6/24DH
3George5/6/24PTO
4Adam5/6/24PH
Sheet9
Cell Formulas
RangeFormula
E2:E4E2= CHOOSE(TOCOL(IF(B2:D4=DATE(2024,5,6),COLUMN(B2:D4),NA()),3),"","PTO","PH","DH")
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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