UDF in an array formula

Giordano Bruno

Well-known Member
Joined
Jan 7, 2007
Messages
1,352
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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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