Please god someone give me some ideas because at the moment it looks like Excel is just screwing with me...
I haven't posted on this account before but no stranger to Excel, VBA or Formulas. Running Windows 10, Office 365. So, I have a biiig horrible formula with lots of things nested all over the place (See the horrendous code tag at the bottom of the post). Within said beast is the nested formula:
which produces a #VALUE error. Evaluating the first section produces a single cell offset range with a value of 0:
. Evaluating this returns TRUE, happy days. So why does the whole section error? I have tried checking data types, checking for text, wrapping both in a NUMBERVALUE function, all still error as a group but evaluate separately as expected.
To compound my confusion even further if I copy the above formula from its enormous nested parent and run in a separate cell it returns TRUE as it should in the cell value but returns a #VALUE error on the formula bar evaluation??
Goal is to return a Boolean TRUE/FALSE for a complex conditional formatting rule. Minisheet below of the data in question below, based on a PivotTable. Any ideas would be greatly appreciated.
Parent Formula:
Minisheet:
I haven't posted on this account before but no stranger to Excel, VBA or Formulas. Running Windows 10, Office 365. So, I have a biiig horrible formula with lots of things nested all over the place (See the horrendous code tag at the bottom of the post). Within said beast is the nested formula:
Excel Formula:
OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F20,,1)),4),"1","")&MATCH(OFFSET(F20,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F20,,-1))-1)=0
Excel Formula:
{0}=0
To compound my confusion even further if I copy the above formula from its enormous nested parent and run in a separate cell it returns TRUE as it should in the cell value but returns a #VALUE error on the formula bar evaluation??
Goal is to return a Boolean TRUE/FALSE for a complex conditional formatting rule. Minisheet below of the data in question below, based on a PivotTable. Any ideas would be greatly appreciated.
Parent Formula:
Excel Formula:
=IF(AND(F3<>0,OFFSET(F3,-1,)<>F3),IF(COUNTIFS(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1),0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,3)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1),"<7")<=2,OR(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),1),OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),2)),IF(COUNTIFS(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1),0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,3)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1),"<7")<=3,OR(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),1),OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),2),OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),3)),IF(COUNTIFS(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1),0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,3)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1),"<7")<=4,OR(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),1),OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),2),OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),3),OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))=SMALL(IF(OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,1)),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)=0,OFFSET(INDIRECT(SUBSTITUTE(ADDRESS(1,COLUMN(OFFSET(F3,,COLUMN($K$2)-COLUMN(F3))),4),"1",0)&MATCH(OFFSET(F3,,-1),E$1:E$372,0)),1,,COUNTIF(E$1:E$372,OFFSET(F3,,-1))-1)),4)),FALSE))),FALSE)
Minisheet:
OrgMapping Simulator 2.xlsm | |||||||||
---|---|---|---|---|---|---|---|---|---|
E | F | G | H | I | J | K | |||
1 | |||||||||
2 | L4 | L5 | L6 | L7 | L8 | L9 | Sum of Headcount | ||
3 | 0 | ||||||||
4 | 0 | ||||||||
5 | 0 | ||||||||
6 | 0 | ||||||||
7 | 0 | ||||||||
8 | 2 | ||||||||
9 | 0 | ||||||||
10 | 0 | ||||||||
11 | 0 | ||||||||
12 | H&G UK - HR - Employee Development BL - 227033917 | 0 | |||||||
13 | H&G UK - HR - Employee Development Team - 227033915 | 0 | |||||||
14 | H&G UK - HR - Employee Development Team - 227033915 | H&G UK - HR - CIS & EOS Development - 227046280 | 0 | ||||||
15 | H&G UK - HR - Employee Development Team - 227033915 | H&G UK - HR - Employee Development Compliance - 228080540 | 0 | ||||||
16 | H&G UK - HR - Employee Development Team - 227033915 | H&G UK - HR - Employee Development Trainers - 228080538 | 0 | ||||||
17 | 5 | ||||||||
18 | 0 | ||||||||
19 | H&G UK - HR - Lynne Oates - 228090143 | 0 | |||||||
20 | H&G UK - HR - Lynne Oates - 228090143 | LHR HR-BP - 227033914 | 2 | ||||||
21 | H&G UK - HR - Roshnee Khandelwal - 228090139 | 0 | |||||||
22 | H&G UK - HR - Roshnee Khandelwal - 228090139 | EMA HR Services - 227033916 | 2 | ||||||
23 | H&G UK - HR - Roshnee Khandelwal - 228090139 | H&G UK - HR - EMA HR - 228080546 | 4 | ||||||
24 | H&G UK - HR - Roshnee Khandelwal - 228090139 | HR Admin & Passes - 228080547 | 5 | ||||||
25 | H&G UK - HR - Roshnee Khandelwal - 228090139 | HR Dept. Occ Health BL - 227033910 | 0 | ||||||
26 | H&G UK - HR - Rowena Catling - 228090142 | 0 | |||||||
27 | H&G UK - HR - Rowena Catling - 228090142 | HR Recruitment - 228080660 | 4 | ||||||
28 | 0 | ||||||||
Piviot |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
B3:J502 | Expression | =AND(MOD($A3+1,2)=0,B3=B2,ROW()<MATCH("Grand Total",$B:$B,0)) | text | NO |
B3:J502 | Expression | =MOD($A3+1,2)=0 | text | NO |
K3:K373 | Expression | =MOD($A3+1,2)=0 | text | NO |
B3:J502 | Expression | =AND(MOD($A3,2)=0,B3=B2,ROW()<MATCH("Grand Total",$B:$B,0)) | text | NO |
B3:J502 | Expression | =MOD($A3,2)=0 | text | NO |
K3:K373 | Expression | =MOD($A3,2)=0 | text | NO |