Is it possible to use column number in a formula?

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,360
Office Version
  1. 2010
Hello,</SPAN></SPAN>

In the example below I got formula in cell J3 copied to down J32 "=COUNTIF($D$3:$D$37,I3)" which is counting column D numbers, to count column E numbers i need to change the formula to this "=COUNTIF($E$3:$E$37,I3)".</SPAN></SPAN>

Is it possible instead of changing the column letter in the formula if I type in cell G3 = 4 so it count column 4 which is D, and if I type in cell G3 = 5 so it count column 5 which is E </SPAN></SPAN>

Resume: change the formula column letter as per column number assigned in G3</SPAN></SPAN>

Example...</SPAN></SPAN>

Book1
ABCDEFGHIJ
1
2n1n2Unique NumCount D
31629414
471323
5141832
64743
7152453
8253063
93472
1041281
111492
121415100
13610110
1456121
151516130
1613142
171529154
18611161
19913170
2027180
21223190
22321201
23423211
2425220
252426230
26710241
27910251
28515260
292027270
3069280
31111290
32812300
33525
341518
352126
361220
37110
Sheet1
Cell Formulas
RangeFormula
J3=COUNTIF($D$3:$D$37,I3)
J4=COUNTIF($D$3:$D$37,I4)
J5=COUNTIF($D$3:$D$37,I5)


Thank you all</SPAN></SPAN>

Excel 2000</SPAN></SPAN>
Regards,</SPAN></SPAN>
Moti</SPAN></SPAN>
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
How about
=COUNTIF(INDEX($A$3:$E$37,0,G$3),I3)
 
Upvote 0
How about
=COUNTIF(INDEX($A$3:$E$37,0,G$3),I3)
Fluff, yes your formula is doing the job perfect!!

Thank you for your help. Have a nice weekend
</SPAN></SPAN>

Kind Regards
</SPAN></SPAN>
Moti :)
</SPAN></SPAN>
 
Last edited:
Upvote 0
Hello,

If you are using : $D$3:$E$37

In order to still get your results ...

the value of cell G3 must be changed from 4 to 1

Hope this will help
 
Upvote 0
Fluff, yes your formula is doing the job perfect!!

Thank you for your help. Have a nice weekend


Kind Regards

Moti :)


You're welcome & thanks for the feedback
 
Upvote 0
Hello,

If you are using : $D$3:$E$37

In order to still get your results ...

the value of cell G3 must be changed from 4 to 1

Hope this will help
James006, yes I did question to Fluff but as I noticed myself I edit the post#3, as you read it quick, and you replied my question. Thank you for the remake and reply.</SPAN></SPAN>

Have a nice weekend
</SPAN></SPAN>

Kind Regards
</SPAN></SPAN>
Moti
</SPAN></SPAN>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,377
Members
448,955
Latest member
BatCoder

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