UDF in an array formula

Giordano Bruno

Well-known Member
Joined
Jan 7, 2007
Messages
1,356
I've created a UDF that returns the values "Good", "Average", "Bad" depending upon the colour of the text format of a cell. I'm trying to use it in an array formula or a sumproduct formula, but I get only a zero or one which seems to have little relationship with the actual colours of the cells.
This is one attempt =SUM(IF(ChkColor(E5:R5)="Good",1,0)) entered as an array. Gives either 1 or 0.
Another attempt =SUMPRODUCT(--(ChkColorE5:R5)="Good")). Gives either 1 or 0.
The formula =(chkColor(E4)="Good")+(chkColor(F4)="Good"...+(chkColor(R4)="Good" does provide the correct value, but I don't want to use a formula with 14 separate cell references.
Anyone have an idea what I'm doing wrong.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Alternatively, I could write a UDF which looped through each cell in a range and added 1 at each "Good". Can anyone let me know if it is possible to set the range in the UDF as columns E to R on the current row?
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

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