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
 
You would need to have actual dates in A1:L1 for the 1st of each month & then use
Excel Formula:
=AGGREGATE(14,6,Tabel10[[SERIAL NO.]:[SERIAL NO.]]/(Tabel10[[DATE]:[DATE]]>=A$1)/(Tabel10[[DATE]:[DATE]]<=EOMONTH(A$1,0)),1)
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You would need to have actual dates in A1:L1 for the 1st of each month & then use
Excel Formula:
=AGGREGATE(14,6,Tabel10[[SERIAL NO.]:[SERIAL NO.]]/(Tabel10[[DATE]:[DATE]]>=A$1)/(Tabel10[[DATE]:[DATE]]<=EOMONTH(A$1,0)),1)
I'll Try it out when I get there. It has been another great learning experience. Thank You!! 🙏
 
Upvote 0
Glad to help & thanks for the feedback.
 
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)
Hi again Fluff...I guess I didn't think that a few columns in the Months Sheet would change everything (The downside of not fully comprehend what is going on after all)
I tried transferring the formula to my project, but the something happened because I have 3 columns before the column where I enter the formula. So now I get April result in January etc. because COLUMNS($D$2:D$2) is {4}
What can I do?
TextText2Text3JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
117120124125127131132136138138138138
106110115117120124
 
Upvote 0
This will return 1 not 4
Changing D to A returns 1 again
1.JPG
2.JPG
 
Upvote 0
This will return 1 not 4
Even though, it seems to only work right when "Serial No" is in a sequence. If the values of "Serial No" is random I get this weird results. Only July show the right value...

TESTWorkbook.xlsx
A
2
Months


1661101114792.png
 
Upvote 0
That's because I wrote the formula for the data you posted.
 
Upvote 0
That's because I wrote the formula for the data you posted.
Oh...yes, and it worked. I thought I could transfer it to my project. I should have been more clear...sry! Sometimes I think I have made it clear enough....but it easy to think that when I know what I want.
I should have made it clear that the formulas criteria have to be based on month. More precise the point where month changes in column A, from 1 to 2, 2 to 3 etc. When that is found I need it to get the value in "Serial No." column just before it changes to a new month (Well it is actually an amount, but I didn't think that was important)
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,453
Members
448,898
Latest member
drewmorgan128

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