Mar 03 2022 05:12 PM
Can someone help me with a formula or macro to consolidate the following data into one column (K)? I need it to say the frequency with the first letter of the week day to follow. "Weekly T" I am doing this manually right now for 200+ rows and I need an easier way. Any help is appreciated!
Mar 03 2022 05:33 PM
=INDEX(A2:I2,MATCH(1,N(NOT(ISBLANK(A2:I2))),0))
Is this what you are looking for? It works in my spreadsheet if the columns B, D, F, H and J are empty. Enter the formula with ctrl+shift+enter if you don't work with Office365 or 2021.
Mar 03 2022 05:37 PM
Mar 04 2022 04:15 AM
=INDEX(A2:I2,MATCH(1,N(NOT(ISBLANK(A2:I2))),0))&" "&LEFT(INDEX($A$1:$I$1,MATCH(1,N(NOT(ISBLANK(A2:I2))),0)),1)
Maybe with this formula if you want to return e.g. "monthly W ". Enter the formula with ctrl+shift+enter if you don't work with Office365 or 2021.
Mar 04 2022 04:25 AM
@Quadruple_Pawn This looks wonderful!
Mar 04 2022 05:21 AM
=IF(COUNTA(A2:I2)>1,INDEX(A2:I2,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),1))&" "&LEFT(LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),1)),1),1)&" "&INDEX(A2:I2,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),2))&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),2)),1),INDEX(A2:I2,MATCH(1,N(NOT(ISBLANK(A2:I2))),0))&" "&LEFT(INDEX($A$1:$I$1,MATCH(1,N(NOT(ISBLANK(A2:I2))),0)),1))
This could be a solution if there are one or two visits a week. This formula would become more complicated if there were three or four or five visits a week.
However i'm sure that there is an easier solution in Excel versions 2013 and newer. If you work with Office365 or 2021 a possibility can be using formulas like LET and TEXTJOIN.
Mar 04 2022 05:56 AM
Now i understand that within the same week there is either "weekly" or "monthly" or "bi-weekly" and so on. Therefore the result can be e.g. "weekly M W F" but never e.g. "weekly W bi-weekly T".
A solution could be this formula which seems to work in my spreadsheet:
=IF(COUNTA(A2:I2)=1,INDEX(A2:I2,MATCH(1,N(NOT(ISBLANK(A2:I2))),0))&" "&LEFT(INDEX($A$1:$I$1,MATCH(1,N(NOT(ISBLANK(A2:I2))),0)),1),IF(COUNTA(A2:I2)=2,INDEX(A2:I2,MATCH(1,N(NOT(ISBLANK(A2:I2))),0))&" "&LEFT(INDEX($A$1:$I$1,MATCH(1,N(NOT(ISBLANK(A2:I2))),0)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),2)),1),IF(COUNTA(A2:I2)=3,INDEX(A2:I2,MATCH(1,N(NOT(ISBLANK(A2:I2))),0))&" "&LEFT(INDEX($A$1:$I$1,MATCH(1,N(NOT(ISBLANK(A2:I2))),0)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),2)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),3)),1),IF(COUNTA(A2:I2)=4,INDEX(A2:I2,MATCH(1,N(NOT(ISBLANK(A2:I2))),0))&" "&LEFT(INDEX($A$1:$I$1,MATCH(1,N(NOT(ISBLANK(A2:I2))),0)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),2)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),3)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),4)),1),IF(COUNTA(A2:I2)=5,INDEX(A2:I2,MATCH(1,N(NOT(ISBLANK(A2:I2))),0))&" "&LEFT(INDEX($A$1:$I$1,MATCH(1,N(NOT(ISBLA
NK(A2:I2))),0)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),2)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),3)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),4)),1)&" "&LEFT(INDEX($A$1:$I$1,SMALL(IF(A2:I2<>"",COLUMN($A:$I)),5)),1),"")))))
Mar 04 2022 06:27 AM