×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Challenge for you clever people, duty cycle in Excel!

Challenge for you clever people, duty cycle in Excel!

Challenge for you clever people, duty cycle in Excel!

(OP)
Hello people!

I'm reasonable skilled in Excel and for the first time in forever I'm stuck.
I want to create a column with ones and zeros in a "duty cycle" fashion. By changing two parameters I want to be able to change the duty cycle and the period of the ones. If someone manage to do this with formulas I will be impressed.

For instance:
11100000001110000000
This would be duty cycle 30% and period 10.

11111000000000000000111110000000000000000
This would be duty cycle 25% and period 20.

Ultimately I want to decide the length of the column myself but if that's an obstacle then I can adapt.

As a plan B I'm trying to write a macro which will fill in this column for me but it turns out I'm struggling with that to.

RE: Challenge for you clever people, duty cycle in Excel!

CODE

=IF(ROW(A1)<B$1,IF(ROW(A1)<=(B$1*C$1),1,0))
enter in A1 and copy down as far as you care.

Period goes in B1.  Duty cycle goes in C1 as a decimal.

RE: Challenge for you clever people, duty cycle in Excel!

Will you accept a VBA solution?

RE: Challenge for you clever people, duty cycle in Excel!

A1(DC) = 50%
B1(Per) = 10
C1 = "=LEFT(ALL_1s,DC*Per) & LEFT(ALL_0s, (1-DC)*Per)"
D1(ALL_1s)= 1111111111
E1(ALL_0s)= 0000000000


This is a pretty horrible solution, but it is a start, right?

VBA is probably the best / easiest / fastest way to solve this....

RE: Challenge for you clever people, duty cycle in Excel!

(OP)
Damn! You guys are fast!

>MintJulep
Your formula looks very neat but it would only run for one period then it returned FALSE.

>IRstuff
I haven't tried your formula yet but I will as soon as I get some sleep.

I'll be back within 24 hours. I really appreciate your answers! This is very cool!

RE: Challenge for you clever people, duty cycle in Excel!

You didn't say you needed more than one period.

 

RE: Challenge for you clever people, duty cycle in Excel!

CODE

=IF(MOD(ROW(A1),B$1)<B$1,IF(MOD(ROW(A1),B$1)<=(B$1*C$1),IF(MOD(ROW(A1),B$1)=0,0,1),0))

 

RE: Challenge for you clever people, duty cycle in Excel!

(OP)
>MintJulep
"...copy down as far as you care." Oh yeah?
There was more than one period in my examples! What good is it to talk about periods if there is only one? I have a feeling you are a lot smarter than this... :)

Well, I couldn't sleep so I went back to the drawing board.
MintJulep led me on the right track using the Row command.
My solution is:
=IF(MOD(ROW(A1);B$1)<(B$1*C$1);1;0)
Period goes in B1.
Duty cycle goes in C1 as a decimal.

Thanks for your input!

RE: Challenge for you clever people, duty cycle in Excel!

(OP)
You beat me to it, MintJulep! I appreciate your input.

RE: Challenge for you clever people, duty cycle in Excel!

Quote:

What good is it to talk about periods if there is only one?

If its periodic, what's the need to define it more than once?   

RE: Challenge for you clever people, duty cycle in Excel!

(OP)
Good point! I see you are into heat transfer. You wouldn't happend to have any experience with hydraulic fan drives? I realize that it can be a far way from heat transfer to hydraulic fan drives but I might as well ask.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources