PRAVEEN T
asked on
How to update create and update formula based column on excel sheet with macro.
Hi
I have a excel sheet with values on columns. And i have list of formulas that need to updated columns.
I need a vba code that crate a formula column run time and update the values.
I have attached the spread sheet. along with foruma columns need to create and update.
Volumetrics
column -- formula
AN =IF(ISNUMBER(SEARCH("GIP", J4)),1,0)
AO =IF(ISNUMBER(SEARCH("TV",J 4)),1,0)
AP =IF(I4="NO",0,1)
AQ =IF(U4="NO",0,1)
Please help me to resolve this one.. I am very new to excel related task and this is very urgent to do it.
Regards,
final_planning2.xlsm
I have a excel sheet with values on columns. And i have list of formulas that need to updated columns.
I need a vba code that crate a formula column run time and update the values.
I have attached the spread sheet. along with foruma columns need to create and update.
Volumetrics
column -- formula
AN =IF(ISNUMBER(SEARCH("GIP",
AO =IF(ISNUMBER(SEARCH("TV",J
AP =IF(I4="NO",0,1)
AQ =IF(U4="NO",0,1)
Please help me to resolve this one.. I am very new to excel related task and this is very urgent to do it.
Regards,
final_planning2.xlsm
ASKER
Hi Shums,
It's working fine.
I need two more changes on this.
1) Can we also add the column name for it...Here
AN - WGS
AO - TV
AP - SHORT
AQ - DUE
2) I have three more spread sheet in the same workbooks , But these columns need to create between other columns..
How can we identify through the code and update the formula based column..
Pricing
D =IF(ISBLANK(B5),C5,B5)
Q =IF(AND(I6>0,J6>0),"DIR AND IND",IF(AND(I6>0,J6=0),"DI R ONLY",IF(AND(I6=0,J6>0),"I ND ONLY",IF(AND(I6=0,J6=0),"F REE"))))
X =I6*(100-R6)/100
Worksheet : Progen
Q =MIN(K3:P3)
Worksheet : usage2
K =IF(H4>0,1,0)
L =IF(I4>0,1,0)
M =IF(J4>0,1,0)
N =SUM(K4:M4)
O =SUM(H4:J4)/3
Worksheet : Metrics By Stocking Reason
S =D4/E4
Worksheet : Replacement NDC 3
G =VLOOKUP(F4,Usage2!$A$4:$C $1789,3,FA LSE)
3) if the worksheet having the pivottable data.. this code will work?
I have attached the spread sheet .. Please help me
Thanks,
Praveen
final_planning2.xlsm
It's working fine.
I need two more changes on this.
1) Can we also add the column name for it...Here
AN - WGS
AO - TV
AP - SHORT
AQ - DUE
2) I have three more spread sheet in the same workbooks , But these columns need to create between other columns..
How can we identify through the code and update the formula based column..
Pricing
D =IF(ISBLANK(B5),C5,B5)
Q =IF(AND(I6>0,J6>0),"DIR AND IND",IF(AND(I6>0,J6=0),"DI
X =I6*(100-R6)/100
Worksheet : Progen
Q =MIN(K3:P3)
Worksheet : usage2
K =IF(H4>0,1,0)
L =IF(I4>0,1,0)
M =IF(J4>0,1,0)
N =SUM(K4:M4)
O =SUM(H4:J4)/3
Worksheet : Metrics By Stocking Reason
S =D4/E4
Worksheet : Replacement NDC 3
G =VLOOKUP(F4,Usage2!$A$4:$C
3) if the worksheet having the pivottable data.. this code will work?
I have attached the spread sheet .. Please help me
Thanks,
Praveen
final_planning2.xlsm
Hi Praveen,
I will reply later. I am away from laptop.
I will reply later. I am away from laptop.
ASKER
Thank you
ASKER
Another Issue also am getting below line of code..
Ws.Range("I4:I" & LRow).FormulaR1C1 = "=VLOOKUP(R[0]C6,Usage2!$A $4:$C$1789 ,3,FALSE)" <-- this one correct?
this is the original formula...
VLOOKUP(F4,Usage2!$A$4:$C$ 1789,3,FAL SE)
Ws.Range("I4:I" & LRow).FormulaR1C1 = "=VLOOKUP(R[0]C6,Usage2!$A
this is the original formula...
VLOOKUP(F4,Usage2!$A$4:$C$
No.
This is not the correct way, you need to transforming Excel Formula into VBA Formula.
I am back, let me finish above changes, then I will make other changes.
This is not the correct way, you need to transforming Excel Formula into VBA Formula.
I am back, let me finish above changes, then I will make other changes.
ASKER
Thank you.
In which sheet you are using this formula?
VLOOKUP(F4,Usage2!$A$4:$C$ 1789,3,FAL SE)
I dont see sheet named usage2 , Metrics By Stocking Reason & Replacement NDC 3
VLOOKUP(F4,Usage2!$A$4:$C$
I dont see sheet named usage2 , Metrics By Stocking Reason & Replacement NDC 3
ASKER
That one is different sheet..let n
Even the formula doesn't interpret your expected result.
For eg: Pricing sheet, from row 5 there is no data at all and your formula is from B5 & J5
For eg: Pricing sheet, from row 5 there is no data at all and your formula is from B5 & J5
Please upload relevant sample as per your required changes.
Please try below with 1st change with Column Header.
Please try below with 1st change with Column Header.
Sub AddFormulas()
Dim Ws As Worksheet
Dim LRow As Long
Application.ScreenUpdating = False
Set Ws = Worksheets("Volumetrics")
LRow = Ws.Range("A" & Rows.Count).End(xlUp).Row
Ws.Activate
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Ws.Range("AN1").Value = "WGS"
Ws.Range("AO1").Value = "TV"
Ws.Range("AP1").Value = "SHORT"
Ws.Range("AQ1").Value = "DUE"
Ws.Range("AN2:AN" & LRow).FormulaR1C1 = "=IF(ISNUMBER(SEARCH(""GIP"",R[2]C10)),1,0)"
Ws.Range("AO2:AO" & LRow).FormulaR1C1 = "=IF(ISNUMBER(SEARCH(""TV"",R[2]C10)),1,0)"
Ws.Range("AP2:AP" & LRow).FormulaR1C1 = "=IF(R[2]C9=""NO"",0,1)"
Ws.Range("AQ2:AQ" & LRow).FormulaR1C1 = "=IF(R[2]C21=""NO"",0,1)"
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub
Please post relevant sample, I will provide code tomorrow, its getting late here.
ASKER
Sure. Thank you
ASKER
All the issues are resolved except the following issue..
For Ex::
I have a work sheet with following columns.
A B C D
here B is formula column.
Through the vba code, I need to create the B column.
Before
A B C
after
A B C(B) D(C)
Please help on this issue...
Thank you.
For Ex::
I have a work sheet with following columns.
A B C D
here B is formula column.
Through the vba code, I need to create the B column.
Before
A B C
after
A B C(B) D(C)
Please help on this issue...
Thank you.
Hi Praveen,
This is another issue, please attach a sample.
This is another issue, please attach a sample.
ASKER
Hi,
I will send you in 10 min
Thanks
I will send you in 10 min
Thanks
ASKER
Hi
Please check attached sheet.
This is my final requirement , Please help me on this
In this attached spread sheet I have three sheets
M, Priciing and QD
In the QD - I need add a button name ' update'
when the user press the button -- QD > column C Values -- need to send to Sheet 'M' and then process the formula column in 'M' Sheet.
Here is the example::
In QD Sheet > Column 'C' pallet size new value 67 ( old is 50 in column B) .... When user press the button 'Update' ....we need to take this value
and change in sheet 'M' column 'V' Where you can see the '50' in row 6.... we need to change it to '67' then process the formula on this column...
Let me know if you have any question.
final_planning2.xlsm
Please check attached sheet.
This is my final requirement , Please help me on this
In this attached spread sheet I have three sheets
M, Priciing and QD
In the QD - I need add a button name ' update'
when the user press the button -- QD > column C Values -- need to send to Sheet 'M' and then process the formula column in 'M' Sheet.
Here is the example::
In QD Sheet > Column 'C' pallet size new value 67 ( old is 50 in column B) .... When user press the button 'Update' ....we need to take this value
and change in sheet 'M' column 'V' Where you can see the '50' in row 6.... we need to change it to '67' then process the formula on this column...
Let me know if you have any question.
final_planning2.xlsm
Check attached...
Hope this is last change.
You need to be specific in your initial question, every time you start with something and end up with something different.
final_planning_v4.xlsm
Hope this is last change.
You need to be specific in your initial question, every time you start with something and end up with something different.
final_planning_v4.xlsm
ASKER
Sorry shums.. Thank you.
Let me check and update you
Regards,
Praveen
Let me check and update you
Regards,
Praveen
ASKER
It's working fine... Thank you.
Can you please help me on my previous question. When we want to create the formula based column. How we can change existing columns and create the formula column..
example..in the pricing sheet.
We need to create the D column.. but the sheet is already 'D' column....
we need to create ''D' Column and all other columns need to change like ... D > E, E > F and F>G.....and so on.........
Pricing
D =IF(ISBLANK(B5),C5,B5)
Thank you ,
Praveen
Can you please help me on my previous question. When we want to create the formula based column. How we can change existing columns and create the formula column..
example..in the pricing sheet.
We need to create the D column.. but the sheet is already 'D' column....
we need to create ''D' Column and all other columns need to change like ... D > E, E > F and F>G.....and so on.........
Pricing
D =IF(ISBLANK(B5),C5,B5)
Thank you ,
Praveen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
Pleased to help
ASKER
Hi Shums,
Can you please help me this excel to vba for this formula.. I was tried , But in the runtime iam getting error..
excel
=IFERROR(VLOOKUP($D10,OL!$ D$3:$AW$44 546,30,FAL SE),"")
=IFERROR(VLOOKUP($D10,OL!$ D$3:$AW$44 546,31,FAL SE),"")
OL is the spreadsheet .....
Regards,
Praveen
Can you please help me this excel to vba for this formula.. I was tried , But in the runtime iam getting error..
excel
=IFERROR(VLOOKUP($D10,OL!$
=IFERROR(VLOOKUP($D10,OL!$
OL is the spreadsheet .....
Regards,
Praveen
Try below:
Open in new window
Final_Planning_v2.xlsm