Formula function by date

minas84

New Member
Joined
Apr 21, 2021
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Hello all, I need some help. In this test excel I have a formula to read odds color(Green and Red)
Function CheckColor(range)
If range.Interior.Color = RGB(256, 0, 0) Then
CheckColor = "Red"
ElseIf range.Interior.Color = RGB(0, 176, 80) Then
CheckColor = "Green"
Else
CheckColor = "Neither"
End If
End Function




Also a module that
-6 for each red
+(cell value-1)*0.97 for each green

Function Daily(MyRange)
Daily = 0
For Each Cell In MyRange
If Cell.Interior.Color = RGB(255, 0, 0) Then
Daily = Daily - 6
ElseIf Cell.Interior.Color = RGB(0, 176, 80) Then
Daily = Daily + (Cell.Value - 1) * 0.97
Else: Daily = Daily
End If
Next Cell
End Function





I also find function to read the quantity of each day
24 Feb is 3
25 Feb is 1
etc

Now I want some more difficult function.

For the 3 odds of 24 Feb (3.58 red , 1.58 red , 2.77 green)
starting from 0

-6 for each red

(cell value-1)*0.97 for each green

So I want 0 -6 -6 +(2.77-1)*0.97 = -10.28


For 1 odds of 25 Feb (15.12 red)
starting from 0
0-6 = -6

For 4 odds of 26 Feb (7.00 green , 1.80 red , 3.56 green , 2.78 green
starting from 0
0 +(7.00-1)*0.97 -6 +(3.56-1)* 0.97 +(2.78-1)*0.97 = 4.03

etc




What am I doing wrong in this one?

I need to get results from "Daily" module on F1:F100 cells, if A1:A100 has specific "24 Feb"
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Could you help me? Thank you in advance!
 

Attachments

  • test2.jpg
    test2.jpg
    159.9 KB · Views: 5
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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