Aug 15 2021 01:17 AM
Device/OS: PC/Windows 10
Excel version: Office Professional 10 Plus 2010, Version 14.0.7258.5000
I would like to seek for advice for the following
Input data 1: dates in Column A and values and Column C
Input data 2: each value in Column C will be set as a dependent cell in exactly one column from Column F to Column O
If the value is set as a dependent cell in a column (from Column F to Column O), say Column F, then the F1 need to be printed to the left of the value
Please refer to the photo
Illustration 1
Input data 1: I have keyed-in the date in A2 and 29.4786 in C2,
Input data 2: C2 is set as dependent cell of M2 (I keyed in =C2 at M2))
Then, I need to print “theta” (at M1) at B2
Illustration 2
Input data 1: I have keyed-in the date in A6 and 29.4786 in C6,
Input data 2: C6 is set as dependent cell of I5 (I keyed in =C6 at I5))
Then, I need to print “delta” (at I1) at B6
Since I have keyed-in the date in A8 and 979.616 in C8, and keyed-in =C8 in L6, so I need to print “eta” in B8.
Can this be done automatically after the step of input data 2?
Thank you for your help in advanced.
Aug 15 2021 02:58 AM
Solution@VuiLeong You don't mention column E in your description, so I ignored it.
In B2:
=IF(C2="","",INDEX($F$1:$O$1,SUMPRODUCT(($F$2:$O$45=C2)*(COLUMN($F$1:$O$1)-COLUMN($F$1)+1))))
Fill down as far as you want.
Aug 15 2021 03:24 AM - edited Aug 15 2021 03:37 AM
Credit and another example: Updating cell values based on the values of other cells in the same row in Excel
Add this formula to B2:
=IF(NOT(ISBLANK(F2)),$F$1,IF(NOT(ISBLANK(G2)),$G$1,IF(NOT(ISBLANK(H2)),$H$1,IF(NOT(ISBLANK(I2)),$I$1,IF(NOT(ISBLANK(J2)),$J$1,IF(NOT(ISBLANK(K2)),$K$1,IF(NOT(ISBLANK(L2)),$L$2,IF(NOT(ISBLANK(M2)),$M$1,IF(NOT(ISBLANK(N2)),$N$1,IF(NOT(ISBLANK(O2)),$O$2,""))))))))))
This to B4:
=IF(NOT(ISBLANK(F3)),$F$1,IF(NOT(ISBLANK(G3)),$G$1,IF(NOT(ISBLANK(H3)),$H$1,IF(NOT(ISBLANK(I3)),$I$1,IF(NOT(ISBLANK(J3)),$J$1,IF(NOT(ISBLANK(K3)),$K$1,IF(NOT(ISBLANK(L3)),$L$3,IF(NOT(ISBLANK(M3)),$M$1,IF(NOT(ISBLANK(N3)),$N$1,IF(NOT(ISBLANK(O3)),$O$3,""))))))))))
This to B6:
=IF(NOT(ISBLANK(F4)),$F$1,IF(NOT(ISBLANK(G4)),$G$1,IF(NOT(ISBLANK(H4)),$H$1,IF(NOT(ISBLANK(I4)),$I$1,IF(NOT(ISBLANK(J4)),$J$1,IF(NOT(ISBLANK(K4)),$K$1,IF(NOT(ISBLANK(L4)),$L$4,IF(NOT(ISBLANK(M4)),$M$1,IF(NOT(ISBLANK(N4)),$N$1,IF(NOT(ISBLANK(O4)),$O$4,""))))))))))
This to B8:
=IF(NOT(ISBLANK(F5)),$F$1,IF(NOT(ISBLANK(G5)),$G$1,IF(NOT(ISBLANK(H5)),$H$1,IF(NOT(ISBLANK(I5)),$I$1,IF(NOT(ISBLANK(J5)),$J$1,IF(NOT(ISBLANK(K5)),$K$1,IF(NOT(ISBLANK(L5)),$L$5,IF(NOT(ISBLANK(M5)),$M$1,IF(NOT(ISBLANK(N5)),$N$1,IF(NOT(ISBLANK(O5)),$O$5,""))))))))))
Aug 15 2021 05:09 AM
Aug 15 2021 05:12 AM
Aug 15 2021 09:32 AM
Aug 16 2021 11:15 AM
Aug 16 2021 11:40 AM
Aug 16 2021 12:00 PM
COLUMN($F$1:$O$1) does not just return 6, it returns an array of the column numbers of F1:O1:
{6,7,8,9,10,11,12,13,14,15}
COLUMN($F$1:$O$1)-COLUMN($F$1)+1 subtracts 6 then adds 1, so it effectively subtracts 5:
{1,2,3,4,5,6,7,8,9,10}
$F$2:$O$45=C2 returns an array of TRUE/FALSE values: TRUE if a cell in F2:O45 equals C2, FALSE otherwise. When you force Excel to use TRUE/FALSE values in numeric calculations, it treats TRUE as 1 and FALSE as 0.
So when we multiply the array with the array {1,2,3,4,5,6,7,8,9,10}, it will act as an array of all zeros except for a 1 corresponding to the cell that equals C2.
SUMPRODUCT multiplies this with the column index in {1,2,3,4,5,6,7,8,9,10}, all the rest evaluates to 0. So the sum is the column index.
This index is used by the INDEX function to return the appropriate header in F1:O1.
Aug 19 2021 09:24 AM
Aug 15 2021 02:58 AM
Solution@VuiLeong You don't mention column E in your description, so I ignored it.
In B2:
=IF(C2="","",INDEX($F$1:$O$1,SUMPRODUCT(($F$2:$O$45=C2)*(COLUMN($F$1:$O$1)-COLUMN($F$1)+1))))
Fill down as far as you want.