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.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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
 
Upvote 0
The end of the second line should read "IF(E2<D2," Not sure but the board doesn't like my "<" symbol ...
 
Upvote 0
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 ....
 
Upvote 0
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.
 
Upvote 0
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)))))
 
Upvote 0
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)))))
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

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