Help with forumula

davide128

Board Regular
Joined
May 12, 2010
Messages
58
Hi I have this formula and would like to know how to copy it to a range while maintaning the reference..

Code:
=IF(Q2="MAP1234","Qualified in all 50 States",IF(Q2="MAP123","Southern;South and North Central",IF(Q2="MAP12","Southern;South-Central",IF(Q2="MAP13","Southern;North-Central",IF(Q2="MAP14","Southern;Northern",IF(Q2="MAP1","Southern",IF(Q2="MAP234","South and North Central;Northern",IF(Q2="MAP23","South and North Central",IF(Q2="MAP24","South-Central;Northern",IF(Q2="MAP2","South-Central",IF(Q2="MAP34","North-Central;Northern",IF(Q2="MAP3","North-Central",IF(Q2="MAP4","Northern","Does Not Qualify")))))))))))))


so if I do something like this to select range

Code:
Range("A2", "A" + LTrim(Str(ActiveSheet.UsedRange.Rows.count)))
so the end result I need the reference to maintain so that the formula for A3 will be Q3 A4 Q4 A5 Q5 etcc....

I also tried copying the formula into a cell on sheet "Upload" and then ran code below but all it does it paste into specified range as text

Code:
'Add EstarWW Formula
    Sheets("Uploads").Select
    Range("DG2").Select
    Selection.Copy
    Sheets("PCR Format").Select
    Range("C2", "C" + LTrim(Str(ActiveSheet.UsedRange.Rows.count))).Select
    Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Not tested
Code:
Range("A2", "A" + LTrim(Str(ActiveSheet.UsedRange.Rows.count))).Formula = "=IF(Q2=""MAP1234"",""Qualified in all 50 States"",IF(Q2=""MAP123"",""Southern;South and North Central"",IF(Q2=""MAP12"",""Southern;South-Central"",IF(Q2=""MAP13"",""Southern;North-Central"",IF(Q2=""MAP14"",""Southern;Northern"",IF(Q2=""MAP1"",""Southern"",IF(Q2=""MAP234"",""South and North Central;Northern"",IF(Q2=""MAP23"",""South and North Central"",IF(Q2=""MAP24"",""South-Central;Northern"",IF(Q2=""MAP2"",""South-Central"",IF(Q2=""MAP34"",""North-Central;Northern"",IF(Q2=""MAP3"",""North-Central"",IF(Q2=""MAP4"",""Northern"",""Does Not Qualify"")))))))))))))"
</pre>
 
Upvote 0
yeah..I saved as excel macro enabled and not campatiblity mode and it worked...

how about this formula..how do u know where to put the extra quotations marks?

Code:
=IF(AND(D2="",F2=""),"Single Glazed",IF(AND(D2="",F2<>""),"Single Glazed * Low E",IF(AND(D2<>"",F2="",H2="AIR"),"Dual Glazed * Air Fill",IF(AND(D2<>"",F2<>"",H2="AIR"),"Dual Glazed * Air Fill * Low E",IF(AND(D2<>"",F2="",H2="ARG"),"Dual Glazed * Argon Gas",IF(AND(D2<>"",F2<>"",H2="ARG"),"Dual Glazed * Argon Gas * Low E"))))))
 
Upvote 0
In VBA, the entire formula always needs to be enclosed with quotes. If something within your formula is in quotes, you need to enclose that in an extra set of quotes.

yeah..I saved as excel macro enabled and not campatiblity mode and it worked...

how about this formula..how do u know where to put the extra quotations marks?

Code:
=IF(AND(D2="",F2=""),"Single Glazed",IF(AND(D2="",F2<>""),"Single Glazed * Low E",IF(AND(D2<>"",F2="",H2="AIR"),"Dual Glazed * Air Fill",IF(AND(D2<>"",F2<>"",H2="AIR"),"Dual Glazed * Air Fill * Low E",IF(AND(D2<>"",F2="",H2="ARG"),"Dual Glazed * Argon Gas",IF(AND(D2<>"",F2<>"",H2="ARG"),"Dual Glazed * Argon Gas * Low E"))))))
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,461
Members
452,915
Latest member
hannnahheileen

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