Why is this not working?

Aitch

Board Regular
Joined
Jan 27, 2019
Messages
119
Office Version
  1. 2010
Platform
  1. Windows
Hi! I just can't figure this one out so hope someone here can help!


This straightforward formula works fine:

=COUNTIF( INDIRECT( "Z" & L10 & ":Z" &M10),"=1")


I want to replace the "Z" part with this formula that automatically finds the column - SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","")


So shouldn't it look like this?

=COUNTIF( INDIRECT( SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","") & L10 & :SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","") &M10),"=1")


But I keep getting errors - am I missing a "" or ) somewhere?


Thanks!
 
I'm looking to use Column letters with the INDIRECT function like this:

=INDIRECT("C"&($A1),"")

But want to replace the "C" with a formula that looks at the column it is in and moves across 3 columns to F etc

So I can then copy/paste this across a number of columns without having to manually input the new "C" each time
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Don't use INDIRECT.

=INDEX($A:$IV,$A$1,3*(COLUMNS($A$1:B1)-COLUMN($A$1)+1))

Copy across.


Excel 2010
ABCDEFGHI
17151922
2
3
4
5
6
715161819202122
Sheet1
Cell Formulas
RangeFormula
C1=INDEX($A:$IV,$A$1,3*(COLUMNS($A$1:A1)-COLUMN($A$1)+1))
D1=INDEX($A:$IV,$A$1,3*(COLUMNS($A$1:B1)-COLUMN($A$1)+1))
E1=INDEX($A:$IV,$A$1,3*(COLUMNS($A$1:C1)-COLUMN($A$1)+1))
 
Upvote 0
You are a genius dude!

Does this work only relative to the A column? Can I force it to start from a different column?


Also, your previous formula =COUNTIF(OFFSET(INDEX($A:$IV,,COLUMN()),$L10,,$M10-$L10),1)
How can I modify this to count the number of 2 values instead of 1?
And how do I change it to count one column to the left?


PS: Why do my posts keep having different fonts lol?
 
Upvote 0
You had said Column C, that's what I did. However just change the first reference in the formula.
To work in relation to Column C for example:
=INDEX($C:$IV,$A$1,3*(COLUMNS($A$1:A1)-COLUMN($A$1)+1))
Copy across.

The last value in a COUNTIF formula is what you are looking for, so change it to 2.
=COUNTIF(OFFSET(INDEX($A:$IV,,COLUMN()),$L10,,$M10-$L10),2)

=COUNTIF(OFFSET(INDEX($A:$IV,,COLUMN()-1),$L10-1,,$M10-$L10),1)
 
Upvote 0

Forum statistics

Threads
1,224,738
Messages
6,180,673
Members
452,993
Latest member
FDARYABEE

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