A small part of a VBA that calculates the wrong value and I am not sure why. Any ideas? Thank you very much.Please Login or Register to view this content.
D2 = 7
E2 = 4
F2 = 31 (should be 28)
A small part of a VBA that calculates the wrong value and I am not sure why. Any ideas? Thank you very much.Please Login or Register to view this content.
D2 = 7
E2 = 4
F2 = 31 (should be 28)
Hi,
As stated I get F2 to be 24.
Can you explain in a note what you are trying to do. At the moment all that macro is doing is putting the number 4 in E2:E9 and the formula in F2:F9. But first of all the formula is not an absolute reference formula, and I suspect that's really what you want, and when you have something like
Formula:Please Login or Register to view this content.
the first bit where you seem to be trying to multiply by 4 is only multiplying D2 by 4, and the last bit where you seem to deduct the sum of e2:e9 is in fact only deducting the e2 value.
Richard Buttrey
RIP - d. 06/10/2022
If any of the responses have helped then please consider rating them by clicking the small star icon below the post.
Please Login or Register to view this content.
Regards, TMS
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
If the value in E2 is 4 then the value in F2 should be 28. The value in D2 is the select statement that applies the same formula as long as the value is less than 15. I think I need an absolute reference formula as you suggested, but am not familiar with how this is done.
Hi
With a formula like =D2*4-E2 with D2=7, E2=4, then the answer is bound to be 24. Are you sure you do want to deduct E2? Leaving the E2 deduction out is the only way I can see how you would get 28.
Hi,
The value of 24 is what I am trying to get (D2*4-E2), but as of now when I run the code I get a value of 31. Below is the entire code and below that are examples of the output as of now. Thanks.
mean dilution factor μL gDNA μL H2OPlease Login or Register to view this content.
1.35 7 4 31 (should be 24)
1.60 8 4 38 (should be 28)
...but that isn't what you said in post #4. You said you wanted 28.
This is getting confusing. I suggest rather than just post your code you upload the whole workbook so that we can see things in action.
Tell us in a narrative form how you use the workbook, i.e. what cells you change, what you expect to happen and when you want to run the macro.
To the right of your results cells in a spare area, manually add the results you expect to see after the macro has run so that we can see the end goal. Tell us which are the manually entered desired results.
I attached the spreadsheet (NGS_Calculator)
the two cells in red and the two rows labelled empty do not work either, but that is a separate issue. The cells in red are supposed to calculate, but if the value in the dilution factor (column D) is less than 5 they also hightlight red. If the sample name is empty then "-" is supposed to be the cell value for column D,E, and F. Thanks.
Last edited by cmccabe; 04-05-2014 at 01:55 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks