vba returns total Fridays in A2:A6. eg A2:A6 all are Fridays, the value should be 5.
vba returns total Fridays in A2:A6. eg A2:A6 all are Fridays, the value should be 5.
If you are trying to count the number of Fridays in that range use the array formula:
=SUM((WEEKDAY(A2:A6)=6)*1)
confirmed with CTRL+SHIFT+ENTER.
_________________________________________________________________________
"In theory there is no difference between theory and practice. In practice there is." - Chuck Reid
Any day you learn something new is a day not wasted.
What is the evaluated result? Only the formula is shown in the image.
_________________________________________________________________________
"In theory there is no difference between theory and practice. In practice there is." - Chuck Reid
Any day you learn something new is a day not wasted.
I want: if SUM((WEEKDAY(A2:A6) = 5 then .........
=IF(SUM((WEEKDAY(A2:A6)=6)*1)=5,"Yes","No") CTRL+Shift+Enter
Use the output as the test in your VBA
_________________________________________________________________________
"In theory there is no difference between theory and practice. In practice there is." - Chuck Reid
Any day you learn something new is a day not wasted.
A Basic course in VBA might be beneficial.
asdzxc, what I gave you was a worksheet formula (an array formula in fact as it required C-S-E), not VBA code. You put it in a worksheet then test the Value of the range where it is located as condition for any VBA code.
_________________________________________________________________________
"In theory there is no difference between theory and practice. In practice there is." - Chuck Reid
Any day you learn something new is a day not wasted.
Not clear if you're looking for a worksheet formula or a VBA solution to find number of Fridays in a range
the worksheet formula must be 'Array Entered', that is instead of {Enter} you need to use Control+Shift+Enter instead
You do NOT put the { .... } in yourself, Excel will do that when you do the Control+Shift+Enter
Paul
Last edited by Paul_Hossler; 10-02-2013 at 11:34 AM. Reason: Add note to NOT enter the {..}
stock data was downloaded. my macro can convert daily data into weekly data. if it is weekly data, I want conversion not to act.
asdzxc --
Your Original request #1
total Fridays in a rangevba returns total Fridays in A2:A6. eg A2:A6 all are Fridays, the value should be 5.
Latest post #11
stock data was downloaded. my macro can convert daily data into weekly data. if it is weekly data, I want conversion not to act.
I (for one) am extremely confused.
Yout#1 refers to VBA, but the example uses worksheet functions
My #10 is a simple worksheet formula to count the number of Fridays in a range, and based on your data returns the expected answer of 5
What if anything does your #11 mean to the number of Fridays?????????????????????
Paul