Checking cells against forecast

DocRogers

New Member
Joined
Mar 17, 2014
Messages
35
Office Version
  1. 365
Platform
  1. Windows
A customer gave us a monthly forecast. I want to check the forecast number against historical data. Is there a formula to have excel check a row of cells and highlight the cells that were higher than the forecast in green and if they were lower to red and ignore the ones that are equal to the forecast. I tried to use conditional formatting but it seems to be for one cell not 12 as i want to check the sales in each of the last 12 months and have each one show one of the required colors. Thank you
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
select the 12 cells you want to check
say A2:L2
12 months
assuming that is the Actuals
and then the forcast is in AA2:AL2

now setup 2 rules

=A2<AA2
so below forecast and format RED

2nd rule
=A2>AA2
so above forecast and format Green

Book1
ABCDEFGHIJKLMZAAABACADAEAFAGAHAIAJAKAL
1mth-Act-1mth-Act-2mth-Act-3mth-Act-4mth-Act-5mth-Act-6mth-Act-7mth-Act-8mth-Act-9mth-Act-10mth-Act-11mth-Act-12F-Cast-1F-Cast-2F-Cast-3F-Cast-4F-Cast-5F-Cast-6F-Cast-7F-Cast-8F-Cast-9F-Cast-10F-Cast-11F-Cast-12
2101214982611214131091315121013112141314
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:L2Expression=A2>AA2textNO
A2:L2Expression=A2<AA2textYES


for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
A2:L2 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:
=A2>AA2

Format [Number, Font, Border, Fill] - Green
choose the format you would like to apply when the condition is true
OK >> OK

repeat for red
=A2<AA2
 
Last edited:
Upvote 0
Solution
Well not sure why this isn't working. I followed your steps and the first row works but the lines below it only show the RED even if the number is greater than the forecast. I've pasted a copy below along with a screen shot of the formula. What am i doing wrong here?
1676655556048.png


QTY SOLD 12 MNTHFeb. 23Jan. 23Dec. 22Nov. 22Oct. 22Sept. 22Aug. 22Jul. 22Jun. 22May. 22Apr. 22Mar. 22Feb. 22Year ForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecast
1893555000200001500025000
17500​
12500​
15000​
15000​
15000​
15000​
9355​
17500​
7500​
210,86717484174841748417484174841748417484174841748417484174841748417484
15000000
1500​
0​
0​
0​
0​
0​
0​
0​
0​
6,292237237237237237237237237237237237237237
630001000600070005000
5000​
5000​
5000​
5000​
5000​
10000​
3000​
6000​
0​
69,0185,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,835
6064000167400
10000​
5000​
0​
6000​
4000​
10000​
4000​
4900​
0​
75,6405,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,002
10000000
0​
0​
0​
400​
0​
0​
0​
600​
0​
2,243180180180180180180180180180180180180180
12520001000012000012000060000
100000​
60000​
90000​
110000​
120000​
120000​
100000​
70000​
172000​
1,205,027102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565
240000003000030000
60000​
0​
40000​
10000​
10000​
14000​
0​
16000​
30000​
168,2667,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,480
1456200800000020000050100
100000​
0​
90000​
20000​
30000​
30000​
60000​
30000​
46100​
471,93114,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,184
46000020000310003000040000
30000​
30000​
50000​
50000​
30000​
20000​
30000​
49000​
50000​
513,27041,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,926
8416210001200059488000
12000​
4512​
2380​
4000​
8000​
4000​
11000​
4002​
7320​
82,9447,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,073
 
Upvote 0
you are only selecting to row 11 - which is why its just that section to J11

OCT 22 column looks like TEXT when i copied into a spreadsheet - so will not compare

you can see the numbers are right justified

Try cell * 1 = see if you get a number or a value error

where does the data come from

enter data into some cells , manually and make it so they are bigger then the forecast and it will then turn green , i'm sure
 
Upvote 0
you are only selecting to row 11 - which is why its just that section to J11

OCT 22 column looks like TEXT when i copied into a spreadsheet - so will not compare

you can see the numbers are right justified

Try cell * 1 = see if you get a number or a value error

where does the data come from

enter data into some cells , manually and make it so they are bigger then the forecast and it will then turn green , i'm sure
I was only testing the first 11 rows so that was why it is showing that. I will cover the whole sheet once I've figured out the error. I just wanted to work with a smaller group as i thought it would be easier. I will reformat the cells to just numbers to fix the text error. I will try the Cell * 1= to see about the error. The data is generated from my ERP system as an excel file. Thank you, I will let you know what happens.
 
Upvote 0
some of the values i have changed and manually entered , and the thy do turn red

Aug/Sep

you can see the zero 0 are left justified -- usually means text and where i have overwritten and manually entered have turn red

if you put the file on to a share - I can take a futher look

problem here is the XL2BB add -in reformats and shows as Rigth justified !!!!!

Book4
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1QTY SOLD 12 MNTHFeb. 23Jan. 23Dec. 22Nov. 22Oct. 22Sept. 22Aug. 22Jul. 22Jun. 22May. 22Apr. 22Mar. 22Feb. 22Year ForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecast
218935550002000015000250001750012500150001500015000150009355175007500210,86717484174841748417484174841748417484174841748417484174841748417484
3150000001500000000006,292237237237237237237237237237237237237237
4630001000600070005000500050005000500050001000030006000069,0185,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,835
560640001674001000050000400040001000040004900075,6405,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,002
61000000000040000060002,243180180180180180180180180180180180180180
7125200010000120000120000600001000006000090000110000120000120000100000700001720001,205,027102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565
82400000030000300006000004000010000100001400001600030000168,2667,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,480
91456200800000020000050100100000090000200003000030000600003000046100471,93114,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,184
1046000020000310003000040000300003000050000500003000020000300004900050000513,27041,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,926
1184162100012000594880001200045122380400080004000110004002732082,9447,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,073
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:N11Expression=A2>O2textYES
A2:N11Expression=W2<O2textYES


I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

 
Upvote 0
some of the values i have changed and manually entered , and the thy do turn red

Aug/Sep

you can see the zero 0 are left justified -- usually means text and where i have overwritten and manually entered have turn red

if you put the file on to a share - I can take a futher look

problem here is the XL2BB add -in reformats and shows as Rigth justified !!!!!

Book4
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1QTY SOLD 12 MNTHFeb. 23Jan. 23Dec. 22Nov. 22Oct. 22Sept. 22Aug. 22Jul. 22Jun. 22May. 22Apr. 22Mar. 22Feb. 22Year ForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecastForecast
218935550002000015000250001750012500150001500015000150009355175007500210,86717484174841748417484174841748417484174841748417484174841748417484
3150000001500000000006,292237237237237237237237237237237237237237
4630001000600070005000500050005000500050001000030006000069,0185,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,8355,835
560640001674001000050000400040001000040004900075,6405,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,0025,002
61000000000040000060002,243180180180180180180180180180180180180180
7125200010000120000120000600001000006000090000110000120000120000100000700001720001,205,027102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565102,565
82400000030000300006000004000010000100001400001600030000168,2667,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,4807,480
91456200800000020000050100100000090000200003000030000600003000046100471,93114,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,18414,184
1046000020000310003000040000300003000050000500003000020000300004900050000513,27041,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,92641,926
1184162100012000594880001200045122380400080004000110004002732082,9447,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,0737,073
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:N11Expression=A2>O2textYES
A2:N11Expression=W2<O2textYES


I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

I've put a copy in dropbox WIP.xlsx
 
Upvote 0
I've put a copy in dropbox WIP.xlsx
So I was thinking about what you said and I went through the numbers in my Forecast columns and retyped them and boom the formula worked. I tried just formatting the cells but even if I pick number it still isn't recognizing them as numbers so it looks like i will have to retype them all to make this work or at least the first column and then I can drag and copy them to the rest of the Forecast columns.
 
Upvote 0
yes, the Forecast looks like text in that file

Edit
seems you have code 202 -
I used
=SUBSTITUTE(W2,CHAR(CODE(LEFT(W2))),"")*1

in a new cell and that cleared it and created a number .........

the system is generating hidden characters and so you may need to use the above formula to change to a number

other things like
text to columns
*1 +0
Copy 1 and paste special multiply did not work

if you try and Left,Right , Centre justify the number do not do that and in the formula bar you can see there are something - hidden characters -

you can see here
 

Attachments

  • Screenshot 2023-02-17 at 22.34.39.png
    Screenshot 2023-02-17 at 22.34.39.png
    182.7 KB · Views: 6
Upvote 0

Forum statistics

Threads
1,215,382
Messages
6,124,618
Members
449,175
Latest member
Anniewonder

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