Keebler

Board Regular
Joined
Dec 1, 2021
Messages
167
Office Version
  1. 2021
Platform
  1. Windows
SO, what I am needing is either a formula or VBA here is the criteria


there is a range of dates in column A

then there is a category (for example a MH group for Depression that I oversee/teach)


I have tried a formula

=MAXIFS($A$2:$A$101,$B$2:$B$101,$DF$2) this produces circular references
(df2 is the category name and is referenced in a vlookup formula in column A)
(I think the circular reference is coming from the range in column A including the current
row. - i'll try a ranging option that only counts rows prior to the "current" one before
posting this query)1


what I need is for when (this example) the depression group gets entered in column B that a
NEW date will be entered in column A that is a specific number of days (seven in this case)
past the most recent date. The caveat is that the depression group is NOT the only category
of entries for column B. there may be may be as many as 20 different categories each with
different date requirements. Each of the date requirements can be in a separate area of the
spreadsheet that can be referenced by either the formula(s) or VBA. the date requirements
can and usually changes as time evolves.

right now it does not matter if the date produced is in the future, but historically the
category and date are entered post event.



--
1 I added the following formula "=COUNTIF($A2:$A100,"<>")+1"
this produced the correct last line number "13"

however, when i created the dynamic range addresses
2024.xlsm
DBDCDD
113
2$A$13$A$2:$A$13
3$B$13$B$2:$B$13
DATA
Cell Formulas
RangeFormula
DB1DB1=COUNTIF($A$2:$A$100,"<>")+1
DB2DB2=ADDRESS($DB$1,1)
DB3DB3=ADDRESS($DB$1,2)
DD2DD2="$A$2:"&$DB$2
DD3DD3="$B$2:"&$DB$3



using these I wrote
=MAXIFS(INDIRECT("$DD$2"),INDIRECT("$DD$3"),$DF$2)
2024.xlsm
DG
21/0/1900
DATA
Cell Formulas
RangeFormula
DG2DG2=MAXIFS(INDIRECT("$DD$2"),INDIRECT("$DD$3"),$DF$2)


this then produced
1/0/190 which is incorrect
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
you have the indirect cell reference in""
should be
=MAXIFS(INDIRECT($DD$2),INDIRECT($DD$3),$DF$2)

Book3
DBDCDDDEDFDGDH
15
2$A$5$A$2:$A$5fred66
3$B$5$B$2:$B$5
Sheet1
Cell Formulas
RangeFormula
DG2DG2=MAXIFS(INDIRECT($DD$2),INDIRECT($DD$3),$DF$2)
DH2DH2=MAXIFS(A2:A5,B2:B5,"fred")
DB2DB2=ADDRESS($DB$1,1)
DB3DB3=ADDRESS($DB$1,2)
DD2DD2="$A$2:"&$DB$2
DD3DD3="$B$2:"&$DB$3


Book3
AB
1
221
34fred
454
56fred
Sheet1
 
Upvote 0
thank you, oversight on my part
but I am still getting the circular reference error when doing the vlookup in column A and B

2024.xlsm
AB
14 
DATA
Cell Formulas
RangeFormula
A14A14=IF(B14="","",IF(ISERROR(VLOOKUP(B14,$DF$2:$DH$10,3,FALSE)),"",VLOOKUP(B14,$DF$2:$DH$10,3,FALSE)))


putting anything (of the predefined options) in the search (column b) produces a circular error.
 
Upvote 0
i dont see a circular ref from what you have posted
 
Upvote 0
SO, it does not matter what item is put in column b if that item is in the vlookup search field (df2:dh12) it returns a circular reference for me.
it points cell (dg2) with =MAXIFS(INDIRECT($DD$2),INDIRECT($DD$3),$DF$2) - this harvests data from column b and compares data from column a

2024.xlsm
DBDCDD
114
2$A$14$A$2:$A$14
3$B$14$B$2:$B$14
DATA
Cell Formulas
RangeFormula
DB1DB1=COUNTIF($A$2:$A$100,"<>")+1
DB2DB2=ADDRESS($DB$1,1)
DB3DB3=ADDRESS($DB$1,2)
DD2DD2="$A$2:"&$DB$2
DD3DD3="$B$2:"&$DB$3


2024 .xlsm
DGDH
1
24/11/20244/18/2024
DATA
Cell Formulas
RangeFormula
DG2DG2=MAXIFS(INDIRECT($DD$2),INDIRECT($DD$3),$DF$2)
DH2DH2=IF(DG2="","",DG2+DK2)


and for reference
2024 .xlsm
A
21/18/2024
32/1/2024
42/8/2024
52/15/2024
62/22/2024
72/29/2024
83/7/2024
93/14/2024
103/21/2024
113/28/2024
124/4/2024
134/11/2024
DATA
 
Upvote 0
im thinking that this can be achieved much more efficiently using vba.
i just do not know how to compile all the various data DYNAMIC data points
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

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