Replace column letter with letter in other cell

Okoth

Board Regular
Joined
Sep 10, 2009
Messages
106
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I have 5 columns, 5 rows like this

ABCDE
1a111aC
2b212
3c313
4d414
5e515

<tbody>
</tbody>


I'd like to use SUM.IF to get the value from the column that is determined by the value in cell E1. The value in E1 is the result of a formula.

I'm kind of looking for a formula like this =SOM.ALS(A1:A5,A1,E1&"1":E1&"5") but of course that doesn't work.

How can I do this?
Thanks
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Will this work for you?
Excel Workbook
ABCDEFGH
1a1.0011.00ac13<<<
2b2.0012.00
3c3.0013.00
4d4.0014.00
5e5.0015.00
Sheet1
Excel 2007
Cell Formulas
RangeFormula
G1=SUMIF(A1:A5,INDIRECT("E1"),C1:C5)
 
Upvote 0
Woops, perhaps you mean to have it this way/......
Excel Workbook
ABCDEFGH
1a1.0011.00ac13<<<
2b2.0012.00
3c3.0013.00
4d4.0014.00
5e5.0015.00
Sheet1
Excel 2007
Cell Formulas
RangeFormula
G1=SUMIF(A1:A5,INDIRECT("E1"),INDIRECT(E1&"1:"&E1&5))
 
Upvote 0
Thank you for the reply, Jim. It works indeed, if all data is on one page. I thought I would manage when I had this formula, but unfortunately not.

The actual situation is that there are 2 excel files. One file gets data from the other.

When I do just a simple SUMIF formula, I get the result. The formula is this

=SUMIF('[estimate stock june1.xls]25 june'!$B:$B,A6,'[estimate stock june1.xls]25 june'!$W:$W)

If I could change the $W:$W in the formula with the INDIRECT from your example, I would be good.

I would like to copy with SUMIF the values of column W from estimate stock june1.xls into a second sheet where I do some calculations.

The right column, in this case W, is calculated on the same sheet and tab where I want the date copied to. The problem is that when the date changes, the column in the estimate stock june1.xls sheet will be a different one. Every day, there will be a new calculation based on the current date.

I hope you'll understand what I mean.

Thanks for your help

Jeroen
 
Upvote 0
How about
=SUMIF('[estimate stock june1.xls]25 june'!$B:$B, A6, INDEX('[estimate stock june1.xls]25 june'!$A:$Z,CODE(UPPER(E1))-64 ,0))
Which only works for A-Z.

replace

INDEX('[estimate stock june1.xls]25 june'!$A:$Z, MATCH(V11, LEFT(ADDRESS(1,COLUMN(1:1),4),1+(26<COLUMN(1:1))),0) , 0)
 
Last edited:
Upvote 0
As I should have said,
Replace '[estimate stock june1.xls]25 june'!$W:$W

in that formula with

INDEX('[estimate stock june1.xls]25 june'!$1:$65536, MATCH(E1, LEFT(ADDRESS(1,COLUMN(1:1),4),1+(26<COLUMN(1:1))),0), 0)

and it will look to the column whose letter is in E1
 
Upvote 0
Hi Mike,

I've tried it but no luck yet. This is the formula I have so far:

=SUMIF('[estimasi stok juni1.xls]25 juni'!$B:$B,A6,INDEX('[estimasi stok juni1.xls]25 juni'!$1:$65536; MATCH(E1, LEFT(ADDRESS(1,COLUMN(1:1),4),1+(26)))))

but I get a VALUE? error.

Also when I look at the row colors, the part COLUMN(1:1) is colored in the calculation sheet and not in the data sheet. Shouldn't it be colored in the data sheet?
Could you check the ))) as well to see if they are at the right spot? I think they are, though.

Thanks for the help.
 
Upvote 0
The formula got cut off by this editor.
Put this in [Shifts]Sheet1!C6

Code:
=SUMIF('[estimasi stok juni1.xls]25 juni'!$B:$B, A6, INDEX('[estimasi stok juni1.xls]25 juni'!$1:$1048576, 0,MATCH(C1, LEFT(ADDRESS(1,COLUMN(6:6),4),1+(26 < COLUMN(6:6)) ),0 ) ) )

It needs to be entered with Ctrl-Shift-Enter (Cmd+Return for Mac)
 
Upvote 0
I really can't figure out why I get an error message with this formula, but still get one.

The error refers to $1 in the formula. What I also notice is that the C1 in the formula is not highlighted.

I entered it with Ctrl-Shift-Enter

Thanks for putting so much time in it Mike. I thought the answer would be something simpler than this.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,690
Members
449,117
Latest member
Aaagu

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