Table/Array formula question (I think)

odonovanc

Board Regular
Joined
Oct 4, 2017
Messages
60
Office Version
  1. 365
Let's say I have data that looks like this:

President
June 20, 2021​
June 21, 2021​
June 22, 2021​
June 23, 2021​
June 24, 2021​
June 25, 2021​
George Washington
1​
1​
1​
John Adams
1​
1​
Thomas Jefferson
1​
1​
James Madison
1​
1​
1​
1​
1​
1​

I want to look up this data and create a table that would look like this:

PresidentDate 1Date 2Date 3Date 4Date 5Date 6
George Washington
June 20, 2021​
June 22, 2021​
June 25, 2021​
John Adams
June 21, 2021​
June 22, 2021​
Thomas Jefferson
June 23, 2021​
June 24, 2021​
James Madison
June 20, 2021​
June 21, 2021​
June 22, 2021​
June 23, 2021​
June 24, 2021​
June 25, 2021​

So I am looking for a formula that will scan the data and the first time it sees a "1" for each president, it will bring in that date. The second time it sees a "1" it brings in the corresponding date, etc. Let's assume that the "president" column heading is cell A1. I am looking for a formula that I can write for each of the dates for each of the presidents that will correctly pull all of this in. Can anyone help?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi, try:
Tests.xlsm
ABCDEFG
1PresidentJune 20, 2021June 21, 2021June 22, 2021June 23, 2021June 24, 2021June 25, 2021
2George Washington111
3John Adams11
4Thomas Jefferson11
5James Madison111111
6
7PresidentDate 1Date 2Date 3Date 4Date 5Date 6
8George WashingtonJune 20, 2021June 22, 2021June 25, 2021   
9John AdamsJune 21, 2021June 22, 2021    
10Thomas JeffersonJune 23, 2021June 24, 2021    
11James MadisonJune 20, 2021June 21, 2021June 22, 2021June 23, 2021June 24, 2021June 25, 2021
1
Cell Formulas
RangeFormula
B8:G11B8=IFERROR(INDEX($A$1:$G$1,AGGREGATE(15,6,COLUMN($B2:$G2)/($B2:$G2=1),COLUMNS($B$7:B$7))),"")
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

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