How to turn Functions into Code

autigers

Board Regular
Joined
Oct 9, 2005
Messages
139
I have the following Formula that I wish to put in code and then transfer the sums to a seperate sheet in the same workbook. After the data tranfer is complete, I would like to clear the input sheet ....
=IF(C2="","",IF
(E2="","",IF(E2
<D2,IF(F2="",
E2+1-D2,(E2+
1)-(D2+$V$2)
),IF(F2="",E2-
D2,D2-(E2+
$V$2)))))

Any help would be greatly appreciated.
 

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

Can you please review the formula. As it stands, I get an error when entering. Somewhere at the end of line2 and start of line3 - I think.


Tony
 

autigers

Board Regular
Joined
Oct 9, 2005
Messages
139
The end of the second line should read "IF(E2<D2," Not sure but the board doesn't like my "<" symbol ...
 

autigers

Board Regular
Joined
Oct 9, 2005
Messages
139
Sorry .. it sholud be IF(E2 Is Less than D2,IF(F2="",... The board cuts off my message if I use a less than symbol ....
 

autigers

Board Regular
Joined
Oct 9, 2005
Messages
139
Did that work ?
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,835
Paste in you formula, highlight it and click on the code button, we will be able to see it then and do not break it into multiple lines.
 

poorwallace

Active Member
Joined
Mar 8, 2005
Messages
365
stictly going by trying to make the formula correct, this was what I came up with...

Code:
=IF(C2="","",IF(E2="","",IF(E2+1-D2,((E2+1)-(D2+$V$2)),IF(F2="",E2-D2,D2-(E2+$V$2)))))
 

autigers

Board Regular
Joined
Oct 9, 2005
Messages
139
Code:
=IF(C2="","",IF(E2="","",IF(E2<D2,IF(F2="",E2+1-D2,(E2+1)-(D2+$V$2)),IF(F2="",E2-D2,D2-(E2+$V$2)))))
 

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

Got the formula. Now go back to the original question. Do you want to put this formula into a cell and copy it to a range, then take the results to another place, or do you want this evaluated in code, with the results put onto the sheet somewhere???


Tony
 

autigers

Board Regular
Joined
Oct 9, 2005
Messages
139
The latter ...
It now resides in every row in column G. From Rows G2:G150.
I would like to have the code loop through the range in the formula and perform the math placing the results in
Same Worksheet "DailyInput" Column G.

I will try to provide a screen shot of the sheet .... Visual is sometimes better.

Thanks
 

Forum statistics

Threads
1,077,926
Messages
5,337,242
Members
399,134
Latest member
ChetManley

Some videos you may like

This Week's Hot Topics

Top