Which formula to look for change in column and return value from another column/cell

Want2BExcel

Board Regular
Joined
Nov 24, 2021
Messages
112
Office Version
  1. 2016
Platform
  1. Windows
I can't figure out a way to get this to work.
I need a formula for each month A2:L2 which gives me a value from the SERIAL NO column in the DataSheet. The criteria is always the last cell in each month (For demo I have shown in A4:D4 which SERIAL NO's i'm aiming for). I've been looking for something that can find the point in column A (MONTH in DataSheet) where the number increases by 1 and the return the SERIAL NO from the cell just before the number increases. But even if I had figured that out, I see a problem for December, since there is nothing but a empty cell after the last entry

Here's both sheets and the workbook.
JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
106110115117

MONTHDATETEXTSERIAL NO.
127-JanTEXT101
127-JanTEXT102
128-JanTEXT103
131-JanTEXT104
131-JanTEXT105
131-JanTEXT106
224-FebTEXT107
225-FebTEXT108
228-FebTEXT109
228-FebTEXT110
329-MarTEXT111
331-MarTEXT112
331-MarTEXT113
331-MarTEXT114
331-MarTEXT115
428-AprTEXT116
429-AprTEXT117
530-MayTEXT118
530-MayTEXT119
531-MayTEXT120
629-JunTEXT121
629-JunTEXT122
630-JunTEXT123
630-JunTEXT124
710-JulTEXT125
818-AugTEXT126
819-AugTEXT127
925-SepTEXT128
925-SepTEXT129
927-SepTEXT130
927-SepTEXT131
1017-OctTEXT132
1128-NovTEXT133
1129-NovTEXT134
1130-NovTEXT135
1130-NovTEXT136
1229-DecTEXT137
1229-DecTEXT138


TESTWorkbook.xlsx
A
2
Months
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Will you only ever have one years worth of data?
 
Upvote 0
Will you only ever have one years worth of data?
Well yes and no.... For is now, Yes. I use a datasheet specific to 2021, 2022 etc. But I'm working on just using one DataSheet (then it's No to your question), since I have to create a new query for each year. NOT very user-friendly :rolleyes: BUT the Months sheet will ALWAYS be a sheet for every year
Its a working progress (as I learn more and more, I tend to widen my goals :)) I may change something.
 
Upvote 0
Ok, for one years worth of data on the sheet try
Fluff.xlsm
ABCDEFGHIJKLMNOPQ
1MONTHDATETEXTSERIAL NO.JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
2127/01/2021TEXT101106110115117120124125127131132136138
3127/01/2021TEXT102
4128/01/2021TEXT103
5131/01/2021TEXT104
6131/01/2021TEXT105
7131/01/2021TEXT106
8224/02/2021TEXT107
9225/02/2021TEXT108
10228/02/2021TEXT109
11228/02/2021TEXT110
12329/03/2021TEXT111
13331/03/2021TEXT112
14331/03/2021TEXT113
15331/03/2021TEXT114
16331/03/2021TEXT115
17428/04/2021TEXT116
18429/04/2021TEXT117
19530/05/2021TEXT118
20530/05/2021TEXT119
21531/05/2021TEXT120
22629/06/2021TEXT121
23629/06/2021TEXT122
24630/06/2021TEXT123
25630/06/2021TEXT124
26710/07/2021TEXT125
27818/08/2021TEXT126
28819/08/2021TEXT127
29925/09/2021TEXT128
30925/09/2021TEXT129
31927/09/2021TEXT130
32927/09/2021TEXT131
331017/10/2021TEXT132
341128/11/2021TEXT133
351129/11/2021TEXT134
361130/11/2021TEXT135
371130/11/2021TEXT136
381229/12/2021TEXT137
391229/12/2021TEXT138
Data
Cell Formulas
RangeFormula
F2:Q2F2=AGGREGATE(14,6,$D$2:$D$39/($A$2:$A$39=COLUMNS($F2:F2)),1)
 
Upvote 0
Solution
Ok, for one years worth of data on the sheet try
Fluff.xlsm
ABCDEFGHIJKLMNOPQ
1MONTHDATETEXTSERIAL NO.JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
2127/01/2021TEXT101106110115117120124125127131132136138
3127/01/2021TEXT102
4128/01/2021TEXT103
5131/01/2021TEXT104
6131/01/2021TEXT105
7131/01/2021TEXT106
8224/02/2021TEXT107
9225/02/2021TEXT108
10228/02/2021TEXT109
11228/02/2021TEXT110
12329/03/2021TEXT111
13331/03/2021TEXT112
14331/03/2021TEXT113
15331/03/2021TEXT114
16331/03/2021TEXT115
17428/04/2021TEXT116
18429/04/2021TEXT117
19530/05/2021TEXT118
20530/05/2021TEXT119
21531/05/2021TEXT120
22629/06/2021TEXT121
23629/06/2021TEXT122
24630/06/2021TEXT123
25630/06/2021TEXT124
26710/07/2021TEXT125
27818/08/2021TEXT126
28819/08/2021TEXT127
29925/09/2021TEXT128
30925/09/2021TEXT129
31927/09/2021TEXT130
32927/09/2021TEXT131
331017/10/2021TEXT132
341128/11/2021TEXT133
351129/11/2021TEXT134
361130/11/2021TEXT135
371130/11/2021TEXT136
381229/12/2021TEXT137
391229/12/2021TEXT138
Data
Cell Formulas
RangeFormula
F2:Q2F2=AGGREGATE(14,6,$D$2:$D$39/($A$2:$A$39=COLUMNS($F2:F2)),1)
Yes it works :) Had to edit it a little since it on two different sheets. But the cell reference is always the same A$2 to L$2, so it ends up to this:
VBA Code:
=AGGREGATE(14,6,Tabel10[SERIAL NO.]/(Tabel10[MONTH]=COLUMNS(A$2)),1)
and so fourt with B$2 etc.
But it's just what I imagined, Thank you!
...And when I come to the point where I just use one DataSheet covering multiple years. What then?
 
Upvote 0
The formula needs to be
Excel Formula:
=AGGREGATE(14,6,Tabel10[SERIAL NO.]/(Tabel10[MONTH]=COLUMNS($A$2:A$2)),1)
and then drag right otherwise you will just get Decembers number each time.
 
Upvote 0
The formula needs to be
Excel Formula:
=AGGREGATE(14,6,Tabel10[SERIAL NO.]/(Tabel10[MONTH]=COLUMNS($A$2:A$2)),1)
and then drag right otherwise you will just get Decembers number each time.
Ok, I see your point. But I have never figured out how to "absolute" reference this part: Tabel10[SERIAL NO.]/(Tabel10[MONTH]. I know $A$2 makes A2 an "absolute. But when I drag a formula with these table references the table references changes
=AGGREGATE(14,6,Tabel10[MONTH]/(Tabel10[DATE]=COLUMNS($A$2:A$2)),1)
=AGGREGATE(14,6,Tabel10[DATE]/(Tabel10[TEXT]=COLUMNS($A$2:A$2)),1)
=AGGREGATE(14,6,Tabel10[TEXT]/(Tabel10[SERIAL NO.]=COLUMNS($A$2:A$2)),1)
Creating #NUM! errors
 
Upvote 0
The formula needs to be
Excel Formula:
=AGGREGATE(14,6,Tabel10[SERIAL NO.]/(Tabel10[MONTH]=COLUMNS($A$2:A$2)),1)
and then drag right otherwise you will just get Decembers number each time.
I figured it out. Guess I just gave up a few years ago and never though of searching for an answar now I know what to look for :)
=AGGREGATE(14,6,Tabel10[[SERIAL NO.]:[SERIAL NO.]]/(Tabel10[[MONTH]:[MONTH]]=COLUMNS($A$2:A$2)),1)
 
Upvote 0
Glad you sorted it.
Yeah me to...I really have been fighting with that for a loooong time. I just didn't know what to search for back then...guess I've learned a little, LOL!

...And what do I do with this formula when I come to the point where I just use one DataSheet covering multiple years? Is that a whole new question or is it easy edited to fit that task?
 
Upvote 0

Forum statistics

Threads
1,215,943
Messages
6,127,826
Members
449,411
Latest member
adunn_23

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