Counting a range (not in adjacent columns) and then conditional format

buyshirts

Banned user
Joined
Aug 19, 2015
Messages
37
Office Version
  1. 365
Platform
  1. Windows
So i have a table and i want to conditionally format the whole row if there are 2 negative numbers out of 3 selected columns and these Columns are not adjacent.

If the columns were next to each other i thought i could use something along the lines of

=IF(COUNTIF(A1:C1,"<0") < 2 but if i try to select A1,B1,C1 im getting an error

Any help is much appreciated
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also what is the range & which columns should be checked.
 
Upvote 0
Sorry about that, poor from me!.

So i have worked out how to SUM a non contiguous range using INDIRECT with the following forumla but i assume i need a TRUE or FALSE to use with Conditional formatting?
 
Upvote 0
Thanks for updating your profile, but can you answer my other question?
 
Upvote 0
Sorry again!

So the range is Range is G2:O2 and the Columns to be used are G2,K2,O2

I got to =SUM(COUNTIF(INDIRECT({"G2","K2","O2"}),"<0")) but that is returning me the Vaule 2
 
Upvote 0
Thanks for that, how about
Excel Formula:
=SUMPRODUCT(($G2:$O2<0)*(MOD(COLUMN($G2:$O2),4)=3))>1
 
Upvote 0
Solution
2022-23.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABAPAQARAS
1Week2022/23Running Total2021/22Running Total2020/21Running Total2019/20Running Total2018/19Running Total2017/18Running TotalMonth2016/17Running TotalTotalWeekly Average
21-8846.06-8846.06258.27258.27-1512.83-1512.83-2429.59-2429.591598.101598.101117.591117.59Aug4247.224247.224928.21616.03
320.00-8846.067762.428020.694836.653323.825086.012656.4246.681644.783277.594395.18Aug1241.885489.107724.58965.57
432971.7410992.433226.326550.143366.946023.361219.482864.262612.967008.144876.2010365.3022494.062811.76
54-8846.065835.7016828.1316828.13-1769.914780.234780.236045.3312068.6912068.691516.554380.814380.816715.8813724.0213724.02-4204.446160.8613643.371705.42
653644.5920472.727051.2111831.442711.9214780.613223.797604.60439.4614163.48-226.205934.6612061.441507.68
76-5853.7014619.025976.3817807.823849.2618629.876639.8614244.463724.5017887.981359.977294.6314916.101864.51
87575.0515194.07-4896.3912911.43180.7918810.668769.9123014.379758.4327646.414137.3411431.9717849.812231.23
98 5182.6020376.673548.541540.8214452.259672.025381.4324192.0912123.405308.7528323.1223942.313058.3830704.7916980.772053.4013485.378550.081068.76
109-2442.8017933.87-19247.17-4794.921820.4526012.548035.8536358.973323.8834028.67-506.4012978.97-2101.83-262.73
11103081.7221015.59575.15-4219.773325.8729338.412136.5938495.562027.4536056.124660.8717639.8414049.641756.21
1211-11077.899937.703741.82-477.95-11572.2017766.215945.9344441.491635.2437691.36410.3218050.16915.64114.46
1312 9810.1319747.83-628.847178.466700.51-7751.741472.5419238.75-4953.343464.4247905.9119582.79210.9337902.297197.50116.9818167.1412910.341613.79
Comparison
Cell Formulas
RangeFormula
C2:C3C2=OFFSET('2022'!$D$10,(ROW('2022'!D1)-1)*7,0,1,1)
D2,L2,H2D2=C2
D3,L3:L13,H3:H13D3=IFERROR(SUM(C3+D2),"")
G2:G13G2=OFFSET('2021'!$D$10,(ROW('2021'!D1)-1)*7,0,1,1)
K2:K13K2=OFFSET('2020'!$D$10,(ROW('2020'!D1)-1)*7,0,1,1)
O2:O13O2=OFFSET('2019'!$D$10,(ROW('2019'!D1)-1)*7,0,1,1)
P2,AB2,X2,T2P2=SUM(O2)
P3:P13,AB3:AB13,X3:X13,T3:T13P3=SUM(O3+P2)
S2:S13S2=OFFSET('2018'!$D$10,(ROW('2018'!D1)-1)*7,0,1,1)
W2:W13W2=OFFSET('2017'!$D$10,(ROW('2017'!D1)-1)*7,0,1,1)
AA2:AA13AA2=OFFSET('2016'!$D$10,(ROW('2016'!D1)-1)*7,0,1,1)
E5,U13,Q13,M13,I13,E13,U9,Q9,M9,I9,E9,U5,Q5,M5,I5E5=IF(COUNT(C2:C5),SUM(C2:C5),"")
Y5,Y13,Y9Y5=SUM(W2:W5)
AP2:AP13AP2=SUM(K2,O2,S2,W2,AA2,AE2,AI2,AM2)
AR2:AR13AR2=AVERAGE(K2,O2,S2,W2,AA2,AE2,AI2,AM2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:AR53Expression=SUMPRODUCT((G2:O2<0)*(MOD(COLUMN(G2:O2),4)=3))>1textNO
A2:AR53Expression=AND($AR2<0,$AV2>2)textNO
A2:AR53Expression=AND($AR2<0,$AV2>1)textNO
A2:AR53Expression=$AV2>2textNO


So hopefully i have attached a mini sheet screen shot
What my aim is, is to highlight a whole row which corresponds to week of the year the weekly totals are in Column G-K-O-S-W-AA but i only want to use G-K-O to determine whether the criteria is met.
If you look at Row 2 it starts of with a Blue fill which is correct but then it goes into orange.
 
Upvote 0
You haven't locked the columns ranges as I showed.
 
Upvote 0
Sorry i must of made a mistake when i put in in as the whole table was blue!

Thanks very much for your help, it would be so much easier if i read your posts properly!
 
Upvote 0
Glad it's sorted & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,904
Members
449,194
Latest member
JayEggleton

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