Excel INDEX MATCH column format into row-column format - excel

I have a huge dataset with ID, MEAN, and DATE (in day of the year). I'm sub-setting it below just for example:
OBJECTID MEAN DATE
1 0.960337524 27
2 1.024530873 27
3 1.07565201 27
4 1.32608937 27
5 1.115863256 27
6 0.738648832 27
7 1.209547088 27
8 1.190287749 27
1 1.311272704 43
2 1.421150386 43
3 1.341622942 43
4 1.343600738 43
5 1.322288454 43
6 1.057037145 43
7 1.262514248 43
8 1.148541133 43
1 1.141311572 75
2 1.12654984 75
3 1.125632558 75
4 1.128487158 75
5 1.181200445 75
6 0.820567181 75
7 0.973662794 75
8 0.903646102 75
In this example, the first date is DAY 27 (Jan 27th). I want to reformat this in Excel so DATE is the horizontal header and ID is the first vertical column like this:
OBJECTID 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
1
2
3
4
5
6
7
8
How do I use INDEX and MATCH to populate the cells in the blank table above with the values in the dataset? Not all dates in the table will have a value so I need it to populate it with zero like this:
OBJECTID 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.960337524 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.311272704 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.141311572 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2
3
4
5
6
7
8
This is what I came up with so far:
=IFERROR(INDEX($B$2:$B$2617, MATCH(0, COUNTIF($E2:E2,$B$2:$B$2617)+IF($A$2:$A$2617<>$E2, 1, 0), 0)), 0)
But it doesn't account for the dates with no values. It put the MEAN value for Day 27 into the cell for Day 1.
OBJECTID MEAN DATE OBJECTID 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
1 0.960337524 27 1 0.960337524
2 1.024530873 27 2
3 1.07565201 27 3
4 1.32608937 27 4
5 1.115863256 27 5
6 0.738648832 27 6
7 1.209547088 27 7
8 1.190287749 27 8
1 1.311272704 43
2 1.421150386 43
3 1.341622942 43
4 1.343600738 43
5 1.322288454 43
6 1.057037145 43
7 1.262514248 43
8 1.148541133 43
1 1.141311572 75
2 1.12654984 75
3 1.125632558 75
4 1.128487158 75
5 1.181200445 75
6 0.820567181 75
7 0.973662794 75
8 0.903646102 75
Any advice or push in the right direction would be appreciated!

On condition that there is only one Mean in your data for each combination of ID and Date the formula below will do the job. (Input is the sheet with your data in it.)
=SUMIFS(Input!$B$2:$B$2617,Input!$A$2:$A$2617,$A2,Input!$C$2:$C$2617,B$1)
However, this formula makes the range management too error prone. Luckily most errors in the range setting will result in a formula error but the process can be much simplified by separating range management from data extraction.
I assigned the name Data to the range Input!$A$2:$C$2617. In fact, you would probably construct this range to be dynamic so that it adjusts to the number of data rows you have automatically. But that is an extra benefit of properly managing ranges which is outside the scope of your present question.
Use the range Data in the above formula you arrive at this:-
=SUMIFS(INDEX(Data,,2),INDEX(Data,,1),$A2,INDEX(Data,,3),B$1)
Either this formula or the one first above introduced can be copied to the right and down to cover your entire output table. If they bother you (as they did me) you can suppress the display of zeros in the sheet or in each cell, using the sheet settings or the cell format to do so.

What you can do is create another unique ID using simple "&" (concat) function. Basically add a 4th column which has the formula
=A2&"_"&C2
The above takes the assumption that your first entry is in 2nd row and this formula is for 2nd row as well which you can drag. Once done then you can apply index match on this new ID.
Hope it helps in clearing your query.

Related

How to convert a string of pixels into an image with python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am having a string of pixels of a B/W image in this manner:-
48 34 21 18 16 21 26 36 40...44 53 57 64 82 95 9
of string length 547, and I want these pixels to be converted into an image of 48*48 pixel B/W image.
Is there any python library or PyTorch function to make it possible?
Link to the Notebook
You can use PIL.Image.frombuffer() function for example.
from PIL import Image
pixels = '126 126 129 120 110 168 174 172 173 174 170 157 134 97 78 75 118 119 97 117 142 86 58 71 124 161 162 134 100 119 124 118 153 135 143 180 180 172 153 128 98 67 60 75 85 89 85 98 123 126 131 119 119 172 180 171 155 127 100 82 77 72 54 97 184 151 157 176 125 74 71 114 173 171 136 109 116 118 118 150 152 150 178 191 188 187 180 169 152 127 86 60 74 91 92 95 119 131 127 115 113 153 130 94 71 62 65 69 83 95 79 137 181 174 196 148 88 75 103 149 135 107 100 105 104 112 140 162 178 191 187 181 171 166 159 156 159 155 144 97 54 69 83 91 112 116 100 85 74 73 59 58 67 75 74 80 104 110 96 153 180 182 151 100 103 139 167 172 152 141 135 135 141 163 182 191 191 183 179 169 144 127 132 147 156 154 152 143 92 52 56 78 97 86 69 60 51 48 55 65 74 74 71 92 121 122 115 155 177 166 151 158 181 200 201 208 207 198 187 181 182 189 187 187 179 170 154 119 91 86 101 124 139 154 153 153 132 73 51 60 63 52 48 45 46 54 65 78 79 86 96 131 163 146 133 162 179 193 202 211 205 208 216 218 209 204 191 183 184 183 176 170 153 127 96 98 127 148 148 142 134 140 150 154 149 102 49 53 57 58 65 68 70 75 75 74 90 121 151 176 176 148 156 170 193 209 215 211 203 213 219 212 206 201 183 174 173 166 162 135 101 86 99 147 176 175 166 164 157 146 148 155 154 128 55 53 54 54 77 92 89 68 58 61 69 94 143 171 155 150 161 163 185 197 203 202 207 213 212 209 202 195 176 163 157 153 125 83 86 118 160 179 172 165 161 161 166 164 155 155 153 138 74 54 40 70 110 122 106 92 112 123 116 108 96 94 118 146 155 159 166 174 180 187 198 213 216 205 196 192 178 155 139 117 88 96 131 163 159 142 130 126 123 123 132 139 147 156 158 145 75 59 60 117 163 157 138 157 176 179 186 189 167 121 98 105 123 149 161 162 165 178 196 213 214 199 188 181 171 147 117 97 104 124 134 127 123 131 135 139 138 137 144 146 139 147 135 106 75 69 98 155 184 180 178 189 187 182 181 190 203 198 165 126 102 109 138 162 171 193 216 225 222 204 191 182 154 130 116 118 137 143 125 108 100 96 96 102 122 129 145 158 142 96 90 127 88 50 125 175 195 191 191 189 178 166 165 172 175 178 177 162 139 116 112 130 158 194 211 216 218 202 189 165 132 129 134 143 129 104 86 98 80 90 128 97 70 90 117 149 161 109 127 151 112 58 145 187 200 198 192 185 174 171 180 162 135 117 120 126 128 128 124 116 124 157 171 166 156 126 107 92 101 127 129 104 93 105 119 137 113 136 145 136 118 107 119 149 162 147 152 152 125 77 142 183 189 176 177 178 174 163 118 109 118 109 95 83 94 101 114 134 125 120 152 153 154 152 156 124 99 103 122 111 112 136 151 156 163 160 160 163 155 143 145 159 163 137 141 147 126 86 119 158 161 184 183 185 163 100 98 167 135 126 89 99 116 104 101 146 144 115 162 197 201 191 189 156 112 94 103 108 112 127 141 150 153 155 156 148 141 149 156 157 165 155 144 146 129 86 112 140 156 191 190 179 144 126 159 179 160 150 148 143 135 127 135 138 137 117 151 199 195 178 177 169 123 105 100 106 115 132 138 143 145 145 143 139 149 156 156 151 141 141 143 143 130 94 131 136 142 181 198 188 177 189 193 185 183 166 152 136 123 121 130 125 132 143 186 207 192 177 177 169 140 119 128 141 142 147 154 159 158 155 158 156 153 146 132 114 122 136 136 134 127 105 136 143 151 167 184 190 198 189 175 168 160 148 138 131 131 144 160 181 176 168 212 206 202 198 185 173 160 150 133 139 148 155 158 164 165 158 146 133 119 113 118 127 130 127 126 125 124 113 176 181 163 183 177 177 184 186 183 172 164 160 160 164 165 174 189 184 171 206 218 212 206 198 187 180 177 171 157 125 113 116 121 127 126 126 126 129 133 136 134 128 121 118 117 115 113 111 175 199 166 177 196 190 188 189 190 190 188 186 184 182 183 189 179 150 171 208 219 209 201 191 181 173 167 152 150 159 157 148 149 154 155 157 153 146 142 140 130 124 117 112 113 108 100 104 175 199 190 163 181 191 187 187 191 191 189 185 179 170 161 155 150 168 168 185 221 204 193 181 168 165 157 137 120 126 158 167 164 168 168 166 160 152 147 144 138 127 118 113 106 103 95 95 173 196 200 206 189 175 168 169 171 167 166 159 154 155 162 176 190 172 147 191 213 202 193 179 162 158 154 137 124 108 123 155 163 167 169 167 164 157 151 144 135 128 120 113 106 99 92 89 164 192 203 215 214 208 206 193 183 175 173 176 179 185 194 196 182 142 148 202 213 204 202 187 173 165 154 151 135 112 102 131 154 157 162 161 158 149 142 137 129 123 117 108 101 95 88 85 156 189 205 211 206 206 206 202 197 198 194 197 201 201 195 178 156 129 171 211 216 214 208 190 179 171 168 149 132 117 102 112 134 152 154 150 150 143 137 131 123 119 112 103 96 91 83 84 148 189 202 204 201 198 199 201 202 201 197 194 192 191 177 159 133 136 189 206 208 210 199 186 180 176 161 129 129 117 106 114 126 144 149 149 145 141 135 130 122 116 108 98 93 90 81 83 149 190 200 199 194 196 199 194 193 192 185 182 180 172 161 141 129 159 188 186 193 194 185 176 173 164 123 93 105 104 117 127 125 132 145 149 142 137 134 129 119 111 103 96 92 87 79 83 159 190 197 198 190 188 188 186 182 180 174 169 165 160 145 126 134 180 187 154 158 186 175 154 151 137 99 84 87 101 124 130 131 131 140 146 143 136 133 126 117 109 99 92 88 85 76 80 171 189 192 187 184 182 182 179 173 169 168 160 156 148 135 124 158 191 196 172 158 169 146 126 123 117 103 102 104 114 128 132 135 133 133 143 144 138 130 122 112 104 96 90 87 84 76 73 175 190 184 180 178 173 171 169 167 162 159 156 152 139 123 131 177 189 192 188 177 167 147 122 111 101 100 110 116 117 131 133 133 135 134 140 144 138 129 117 108 103 97 95 92 85 76 69 179 191 186 178 171 168 164 162 156 151 153 150 144 131 118 151 181 191 198 193 183 175 163 136 112 109 115 118 121 126 136 132 130 132 129 137 144 140 127 116 108 105 101 99 92 86 76 67 160 190 184 173 169 161 156 152 148 144 146 147 141 120 126 172 184 195 203 200 191 184 174 159 142 139 133 129 133 138 135 131 124 124 127 130 141 145 132 119 112 109 106 104 96 88 73 64 110 184 188 176 168 158 145 143 144 147 146 146 136 115 145 176 184 198 199 196 197 190 178 163 159 157 149 145 144 141 134 129 121 119 126 128 138 151 141 124 117 113 110 106 98 88 69 60 89 172 189 178 170 163 149 138 144 152 155 154 128 128 166 178 184 193 197 200 198 192 182 170 163 168 162 156 147 140 136 132 121 115 118 124 130 155 152 132 126 118 110 106 98 86 66 56 60 157 186 180 173 167 153 142 155 167 166 156 125 151 174 178 178 185 193 189 191 188 175 168 167 162 144 130 126 122 122 124 118 112 117 121 124 155 163 137 129 118 110 107 104 86 63 57 41 140 184 178 178 170 159 154 172 183 181 158 134 161 170 176 176 184 184 169 156 138 129 134 136 114 101 99 100 99 99 98 103 108 119 128 131 160 171 140 126 113 106 112 108 82 64 60 39 116 184 173 179 171 165 161 182 199 198 170 149 170 170 174 185 173 148 132 123 122 126 120 106 109 124 129 124 97 64 61 58 78 112 130 136 165 177 143 121 106 104 124 107 75 63 60 40 86 181 175 176 175 169 162 175 203 203 179 164 179 175 172 143 109 97 84 106 158 175 184 171 164 168 134 76 43 33 65 86 90 105 122 142 174 175 134 116 98 119 135 99 70 60 59 48 69 169 183 173 174 170 164 169 197 209 190 164 179 170 142 130 126 79 44 55 82 127 142 124 112 105 72 54 71 89 111 102 88 96 120 149 180 163 127 110 100 136 126 84 60 57 60 50 59 146 190 174 173 174 168 167 189 204 199 175 164 150 145 168 171 143 111 125 135 144 135 133 139 136 129 128 128 126 112 85 78 102 128 155 174 141 127 100 119 144 114 73 58 60 62 50 50 118 189 181 173 175 171 167 180 196 194 181 166 162 161 163 151 155 164 168 166 164 155 155 155 148 141 135 124 105 85 78 90 122 138 156 149 140 124 98 140 138 94 64 60 63 64 47 48 80 170 191 177 174 180 172 169 187 189 177 170 172 172 169 159 148 142 141 140 139 137 139 133 125 116 106 96 86 81 88 113 122 127 135 142 155 102 119 154 118 76 62 68 65 65 39 46 52 130 185 185 174 182 178 170 174 186 178 171 176 187 178 164 151 135 121 115 118 121 116 110 104 99 93 92 92 93 111 127 125 137 138 161 126 94 144 139 96 70 69 71 61 74 35 40 44 84 166 188 183 176 180 178 174 179 185 180 193 193 180 171 160 150 151 154 152 151 146 141 135 119 108 101 96 102 128 137 145 144 133 126 91 118 147 117 82 74 78 72 61 101 38 36 44 53 127 181 187 178 174 181 180 173 183 190 190 196 195 178 164 161 167 172 168 165 171 163 154 141 128 115 104 117 149 155 139 124 111 96 99 139 135 102 88 86 82 72 64 140 43 37 41 43 75 161 181 183 173 174 179 180 175 190 199 197 198 189 181 173 166 171 173 180 176 158 148 141 126 115 113 129 147 136 132 115 97 91 125 148 124 105 94 87 77 66 82 181 44 41 35 41 45 114 177 177 181 177 175 183 184 176 192 198 184 186 195 198 188 173 174 172 167 157 145 138 121 121 115 113 125 146 133 98 83 111 148 145 122 107 90 85 75 58 118 203 48 44 35 36 42 58 144 181 189 188 182 182 187 181 172 180 189 192 193 198 192 186 178 165 160 152 138 128 128 129 110 111 139 132 105 83 97 143 153 137 118 97 87 79 68 68 168 211 45 45 41 32 38 40 90 163 179 190 184 186 185 189 182 176 185 194 199 187 175 173 162 156 156 145 128 125 127 121 104 111 121 110 89 87 131 153 148 130 106 85 77 71 60 107 199 208'
b = bytes(int(p) for p in pixels.split())
i = Image.frombuffer('L', (48, 48), b)
print(i)
i.save('example.png')
Outputs example.png:
Yun can also use numpy to read the fixed-length data and save to image with cv2.
import numpy as np
import cv2
pixels = '126 126 129 120 110 168 174 172 173 174 170 157 134 97 78 75 118 119 97 117 142 86 58 71 124 161 162 134 100 119 124 118 153 135 143 180 180 172 153 128 98 67 60 75 85 89 85 98 123 126 131 119 119 172 180 171 155 127 100 82 77 72 54 97 184 151 157 176 125 74 71 114 173 171 136 109 116 118 118 150 152 150 178 191 188 187 180 169 152 127 86 60 74 91 92 95 119 131 127 115 113 153 130 94 71 62 65 69 83 95 79 137 181 174 196 148 88 75 103 149 135 107 100 105 104 112 140 162 178 191 187 181 171 166 159 156 159 155 144 97 54 69 83 91 112 116 100 85 74 73 59 58 67 75 74 80 104 110 96 153 180 182 151 100 103 139 167 172 152 141 135 135 141 163 182 191 191 183 179 169 144 127 132 147 156 154 152 143 92 52 56 78 97 86 69 60 51 48 55 65 74 74 71 92 121 122 115 155 177 166 151 158 181 200 201 208 207 198 187 181 182 189 187 187 179 170 154 119 91 86 101 124 139 154 153 153 132 73 51 60 63 52 48 45 46 54 65 78 79 86 96 131 163 146 133 162 179 193 202 211 205 208 216 218 209 204 191 183 184 183 176 170 153 127 96 98 127 148 148 142 134 140 150 154 149 102 49 53 57 58 65 68 70 75 75 74 90 121 151 176 176 148 156 170 193 209 215 211 203 213 219 212 206 201 183 174 173 166 162 135 101 86 99 147 176 175 166 164 157 146 148 155 154 128 55 53 54 54 77 92 89 68 58 61 69 94 143 171 155 150 161 163 185 197 203 202 207 213 212 209 202 195 176 163 157 153 125 83 86 118 160 179 172 165 161 161 166 164 155 155 153 138 74 54 40 70 110 122 106 92 112 123 116 108 96 94 118 146 155 159 166 174 180 187 198 213 216 205 196 192 178 155 139 117 88 96 131 163 159 142 130 126 123 123 132 139 147 156 158 145 75 59 60 117 163 157 138 157 176 179 186 189 167 121 98 105 123 149 161 162 165 178 196 213 214 199 188 181 171 147 117 97 104 124 134 127 123 131 135 139 138 137 144 146 139 147 135 106 75 69 98 155 184 180 178 189 187 182 181 190 203 198 165 126 102 109 138 162 171 193 216 225 222 204 191 182 154 130 116 118 137 143 125 108 100 96 96 102 122 129 145 158 142 96 90 127 88 50 125 175 195 191 191 189 178 166 165 172 175 178 177 162 139 116 112 130 158 194 211 216 218 202 189 165 132 129 134 143 129 104 86 98 80 90 128 97 70 90 117 149 161 109 127 151 112 58 145 187 200 198 192 185 174 171 180 162 135 117 120 126 128 128 124 116 124 157 171 166 156 126 107 92 101 127 129 104 93 105 119 137 113 136 145 136 118 107 119 149 162 147 152 152 125 77 142 183 189 176 177 178 174 163 118 109 118 109 95 83 94 101 114 134 125 120 152 153 154 152 156 124 99 103 122 111 112 136 151 156 163 160 160 163 155 143 145 159 163 137 141 147 126 86 119 158 161 184 183 185 163 100 98 167 135 126 89 99 116 104 101 146 144 115 162 197 201 191 189 156 112 94 103 108 112 127 141 150 153 155 156 148 141 149 156 157 165 155 144 146 129 86 112 140 156 191 190 179 144 126 159 179 160 150 148 143 135 127 135 138 137 117 151 199 195 178 177 169 123 105 100 106 115 132 138 143 145 145 143 139 149 156 156 151 141 141 143 143 130 94 131 136 142 181 198 188 177 189 193 185 183 166 152 136 123 121 130 125 132 143 186 207 192 177 177 169 140 119 128 141 142 147 154 159 158 155 158 156 153 146 132 114 122 136 136 134 127 105 136 143 151 167 184 190 198 189 175 168 160 148 138 131 131 144 160 181 176 168 212 206 202 198 185 173 160 150 133 139 148 155 158 164 165 158 146 133 119 113 118 127 130 127 126 125 124 113 176 181 163 183 177 177 184 186 183 172 164 160 160 164 165 174 189 184 171 206 218 212 206 198 187 180 177 171 157 125 113 116 121 127 126 126 126 129 133 136 134 128 121 118 117 115 113 111 175 199 166 177 196 190 188 189 190 190 188 186 184 182 183 189 179 150 171 208 219 209 201 191 181 173 167 152 150 159 157 148 149 154 155 157 153 146 142 140 130 124 117 112 113 108 100 104 175 199 190 163 181 191 187 187 191 191 189 185 179 170 161 155 150 168 168 185 221 204 193 181 168 165 157 137 120 126 158 167 164 168 168 166 160 152 147 144 138 127 118 113 106 103 95 95 173 196 200 206 189 175 168 169 171 167 166 159 154 155 162 176 190 172 147 191 213 202 193 179 162 158 154 137 124 108 123 155 163 167 169 167 164 157 151 144 135 128 120 113 106 99 92 89 164 192 203 215 214 208 206 193 183 175 173 176 179 185 194 196 182 142 148 202 213 204 202 187 173 165 154 151 135 112 102 131 154 157 162 161 158 149 142 137 129 123 117 108 101 95 88 85 156 189 205 211 206 206 206 202 197 198 194 197 201 201 195 178 156 129 171 211 216 214 208 190 179 171 168 149 132 117 102 112 134 152 154 150 150 143 137 131 123 119 112 103 96 91 83 84 148 189 202 204 201 198 199 201 202 201 197 194 192 191 177 159 133 136 189 206 208 210 199 186 180 176 161 129 129 117 106 114 126 144 149 149 145 141 135 130 122 116 108 98 93 90 81 83 149 190 200 199 194 196 199 194 193 192 185 182 180 172 161 141 129 159 188 186 193 194 185 176 173 164 123 93 105 104 117 127 125 132 145 149 142 137 134 129 119 111 103 96 92 87 79 83 159 190 197 198 190 188 188 186 182 180 174 169 165 160 145 126 134 180 187 154 158 186 175 154 151 137 99 84 87 101 124 130 131 131 140 146 143 136 133 126 117 109 99 92 88 85 76 80 171 189 192 187 184 182 182 179 173 169 168 160 156 148 135 124 158 191 196 172 158 169 146 126 123 117 103 102 104 114 128 132 135 133 133 143 144 138 130 122 112 104 96 90 87 84 76 73 175 190 184 180 178 173 171 169 167 162 159 156 152 139 123 131 177 189 192 188 177 167 147 122 111 101 100 110 116 117 131 133 133 135 134 140 144 138 129 117 108 103 97 95 92 85 76 69 179 191 186 178 171 168 164 162 156 151 153 150 144 131 118 151 181 191 198 193 183 175 163 136 112 109 115 118 121 126 136 132 130 132 129 137 144 140 127 116 108 105 101 99 92 86 76 67 160 190 184 173 169 161 156 152 148 144 146 147 141 120 126 172 184 195 203 200 191 184 174 159 142 139 133 129 133 138 135 131 124 124 127 130 141 145 132 119 112 109 106 104 96 88 73 64 110 184 188 176 168 158 145 143 144 147 146 146 136 115 145 176 184 198 199 196 197 190 178 163 159 157 149 145 144 141 134 129 121 119 126 128 138 151 141 124 117 113 110 106 98 88 69 60 89 172 189 178 170 163 149 138 144 152 155 154 128 128 166 178 184 193 197 200 198 192 182 170 163 168 162 156 147 140 136 132 121 115 118 124 130 155 152 132 126 118 110 106 98 86 66 56 60 157 186 180 173 167 153 142 155 167 166 156 125 151 174 178 178 185 193 189 191 188 175 168 167 162 144 130 126 122 122 124 118 112 117 121 124 155 163 137 129 118 110 107 104 86 63 57 41 140 184 178 178 170 159 154 172 183 181 158 134 161 170 176 176 184 184 169 156 138 129 134 136 114 101 99 100 99 99 98 103 108 119 128 131 160 171 140 126 113 106 112 108 82 64 60 39 116 184 173 179 171 165 161 182 199 198 170 149 170 170 174 185 173 148 132 123 122 126 120 106 109 124 129 124 97 64 61 58 78 112 130 136 165 177 143 121 106 104 124 107 75 63 60 40 86 181 175 176 175 169 162 175 203 203 179 164 179 175 172 143 109 97 84 106 158 175 184 171 164 168 134 76 43 33 65 86 90 105 122 142 174 175 134 116 98 119 135 99 70 60 59 48 69 169 183 173 174 170 164 169 197 209 190 164 179 170 142 130 126 79 44 55 82 127 142 124 112 105 72 54 71 89 111 102 88 96 120 149 180 163 127 110 100 136 126 84 60 57 60 50 59 146 190 174 173 174 168 167 189 204 199 175 164 150 145 168 171 143 111 125 135 144 135 133 139 136 129 128 128 126 112 85 78 102 128 155 174 141 127 100 119 144 114 73 58 60 62 50 50 118 189 181 173 175 171 167 180 196 194 181 166 162 161 163 151 155 164 168 166 164 155 155 155 148 141 135 124 105 85 78 90 122 138 156 149 140 124 98 140 138 94 64 60 63 64 47 48 80 170 191 177 174 180 172 169 187 189 177 170 172 172 169 159 148 142 141 140 139 137 139 133 125 116 106 96 86 81 88 113 122 127 135 142 155 102 119 154 118 76 62 68 65 65 39 46 52 130 185 185 174 182 178 170 174 186 178 171 176 187 178 164 151 135 121 115 118 121 116 110 104 99 93 92 92 93 111 127 125 137 138 161 126 94 144 139 96 70 69 71 61 74 35 40 44 84 166 188 183 176 180 178 174 179 185 180 193 193 180 171 160 150 151 154 152 151 146 141 135 119 108 101 96 102 128 137 145 144 133 126 91 118 147 117 82 74 78 72 61 101 38 36 44 53 127 181 187 178 174 181 180 173 183 190 190 196 195 178 164 161 167 172 168 165 171 163 154 141 128 115 104 117 149 155 139 124 111 96 99 139 135 102 88 86 82 72 64 140 43 37 41 43 75 161 181 183 173 174 179 180 175 190 199 197 198 189 181 173 166 171 173 180 176 158 148 141 126 115 113 129 147 136 132 115 97 91 125 148 124 105 94 87 77 66 82 181 44 41 35 41 45 114 177 177 181 177 175 183 184 176 192 198 184 186 195 198 188 173 174 172 167 157 145 138 121 121 115 113 125 146 133 98 83 111 148 145 122 107 90 85 75 58 118 203 48 44 35 36 42 58 144 181 189 188 182 182 187 181 172 180 189 192 193 198 192 186 178 165 160 152 138 128 128 129 110 111 139 132 105 83 97 143 153 137 118 97 87 79 68 68 168 211 45 45 41 32 38 40 90 163 179 190 184 186 185 189 182 176 185 194 199 187 175 173 162 156 156 145 128 125 127 121 104 111 121 110 89 87 131 153 148 130 106 85 77 71 60 107 199 208'
a = list(map(int, pixels.split(' ')))[:48 * 48]
i = np.array(a).reshape((48, 48)).astype('uint8')
cv2.imwrite('a.png', i)
Outputs a.png.
enter image description here

python truncating inputs from shell to specific number

When I am trying to provide a large input, it is truncating to a specific number.
eg. If I input around 50k-100k inputs(156 repeated number of times), its truncates to 1023. But when I provide input around 200k(shown below), it truncates to 1187.
if __name__ == '__main__':
iplist = list(map(int, input().rstrip().split()))
print("len of exp: ",len(iplist))
1) provide very large input:
eg. below is 1686 numbers input , but if you run the above code, it says length is : 1187:
Seems there is some character limit in shell as if I change a few numbers from 3 digit to 2 digit, or 1 digit, this length increases
0 82 180 55 168 41 179 59 139 71 6 12 135 139 73 157 4 74 195 60 45 28 67 136 58 55 22 60 33 84 48 185 118 29 41 86 22 172 145 114 43 103 126 130 43 152 87 199 26 34 59 24 63 79 160 73 86 134 133 71 18 182 57 89 163 98 175 137 70 73 3 113 176 130 43 19 34 83 170 12 117 30 36 132 61 197 5 99 131 91 171 102 25 28 143 188 126 118 77 148 143 81 61 120 163 56 91 149 91 62 161 161 44 198 93 57 195 51 156 78 142 127 132 119 107 75 59 33 146 136 133 89 169 146 161 84 3 5 33 46 67 195 7 63 193 53 120 140 56 28 170 150 156 103 69 63 178 128 49 124 64 182 166 186 129 79 70 84 84 104 82 103 51 42 166 44 95 38 136 103 67 106 53 175 161 122 190 140 50 39 16 66 174 134 52 55 14 123 91 98 179 173 2 30 15 120 26 62 159 114 165 178 172 18 153 134 140 143 26 142 135 42 9 61 129 61 68 143 136 159 193 67 132 195 49 100 68 27 114 27 141 80 157 66 50 110 0 191 5 26 133 92 20 142 105 149 156 173 44 44 84 38 112 169 185 113 69 53 141 183 32 34 15 189 100 66 51 52 9 57 78 94 101 51 37 159 152 145 132 197 189 17 187 53 138 172 167 159 26 108 142 58 94 110 48 195 176 51 47 137 108 78 31 162 129 20 121 33 165 5 182 107 174 169 112 112 142 79 71 120 139 166 178 34 76 178 181 4 30 28 93 90 58 124 4 139 145 125 173 62 131 155 121 57 125 34 170 19 65 41 139 5 159 69 191 187 0 172 143 182 152 36 24 163 161 29 102 58 154 27 120 37 183 194 95 60 28 17 79 93 10 170 50 170 39 193 157 191 117 101 173 22 89 198 185 50 27 87 108 133 115 181 123 50 175 170 62 155 187 141 0 197 63 3 119 102 196 29 46 66 82 19 88 171 169 73 22 196 112 82 82 179 15 157 181 142 127 43 97 66 136 50 15 199 53 135 54 1 116 100 67 198 119 155 121 89 180 95 37 93 178 71 24 145 28 6 88 107 1 137 173 138 139 141 137 192 28 191 146 144 43 13 94 163 169 15 4 101 111 193 146 41 17 171 138 197 129 178 105 130 116 30 68 7 171 158 152 151 149 98 95 193 111 141 108 32 157 64 134 20 57 80 61 26 3 199 24 132 178 129 63 46 111 83 53 35 41 5 186 143 55 34 88 119 175 148 151 132 12 37 104 21 70 165 48 25 117 72 158 47 153 173 93 16 56 98 51 50 56 38 193 63 24 81 182 199 29 134 84 193 123 188 166 145 106 14 171 23 38 129 22 143 54 67 160 62 165 11 112 173 1 105 37 25 138 19 25 119 105 61 64 181 49 31 126 155 45 97 130 36 178 152 179 32 19 139 47 137 151 159 62 152 17 51 130 107 23 155 27 128 168 91 109 17 74 188 125 120 85 7 108 16 160 87 48 131 27 95 20 130 7 35 34 24 86 164 131 109 71 110 190 39 154 99 9 28 39 134 100 125 93 8 141 5 96 141 137 75 189 109 157 196 144 143 172 31 60 103 92 83 166 82 75 120 134 84 148 173 170 1 98 63 9 191 69 57 133 158 84 74 19 41 70 164 137 42 147 197 97 39 80 63 122 155 135 56 191 36 29 113 37 80 129 46 71 150 56 156 108 140 30 127 134 100 43 71 94 190 68 144 182 100 159 104 8 95 112 151 131 141 65 168 21 146 166 45 96 22 1 156 163 184 35 97 36 79 120 131 21 140 27 3 192 186 59 0 81 171 152 12 113 169 132 86 115 99 83 163 121 37 119 36 21 154 85 57 185 157 140 7 97 167 162 90 154 22 42 35 193 146 0 58 115 84 97 182 183 180 145 57 17 64 45 190 171 83 48 156 40 188 163 138 156 78 180 62 100 22 49 45 169 49 104 36 134 153 171 69 133 116 78 103 133 124 93 104 7 93 12 199 82 128 137 190 6 69 52 106 92 101 151 13 103 7 1 189 160 172 10 46 89 89 101 174 165 194 30 124 40 42 123 74 170 13 64 176 82 68 34 126 169 186 139 24 193 141 13 106 113 24 152 154 65 53 128 182 199 158 106 39 1 181 113 123 194 129 100 29 197 134 155 119 72 95 143 18 188 109 124 101 85 76 8 102 81 136 84 32 47 142 72 0 123 137 123 70 67 175 99 16 110 6 135 134 101 31 152 89 92 76 143 129 104 151 31 185 39 115 170 38 57 42 190 132 131 114 154 150 41 53 167 103 60 54 38 113 37 190 155 81 19 98 10 123 1 41 61 192 108 31 31 117 25 21 50 108 87 4 59 129 10 178 184 22 32 22 135 22 165 42 103 184 92 66 59 93 107 72 86 168 55 69 85 80 42 87 189 130 92 0 11 54 178 195 76 162 170 163 184 135 6 40 119 98 106 130 192 165 3 30 133 58 51 171 91 93 58 32 175 150 32 138 4 162 86 32 124 56 196 61 191 2 53 62 52 111 192 44 76 147 26 162 6 29 133 49 75 191 81 50 94 65 141 50 179 27 83 103 83 31 116 26 185 121 88 37 32 32 34 61 180 12 175 138 42 108 139 117 51 172 119 97 37 12 148 168 39 183 23 74 14 140 100 151 61 140 188 46 125 22 107 57 35 34 147 29 142 86 98 145 58 17 43 47 30 143 15 21 126 38 96 92 130 148 43 144 41 183 190 118 158 49 127 145 83 74 174 177 160 72 74 170 41 117 17 23 60 32 45 138 22 93 182 153 193 177 97 186 161 39 104 119 40 183 64 123 57 38 52 17 62 126 187 103 196 156 79 8 140 76 147 163 169 81 68 114 59 117 101 20 156 157 139 196 141 155 71 150 145 123 168 7 1 107 62 197 16 141 158 156 17 105 119 138 138 187 53 197 56 106 17 12 15 108 160 108 63 31 59 8 106 179 167 60 38 182 9 54 75 167 11 45 24 82 183 163 22 188 160 78 46 178 43 14 38 3 122 54 187 181 14 45 112 182 105 151 116 115 5 191 34 168 36 59 51 172 22 25 112 182 103 111 112 146 125 151 102 199 157 89 133 171 134 45 153 192 196 21 59 154 13 93 74 1 152 125 125 126 150 190 61 6 101 173 104 178 76 6 177 33 95 110 5 182 156 110 174 104 132 185 10 97 78 85 50 183 162 176 109 65 166 170 71 19 96 127 197 124 134 126 110 29 37 67 163 145 129 137 1 61 122 164 110 153 1 161 136 163 89 197 180 7 120 51 26 16 131 175 92 65 101 2 46 90 69 10 187 199 99 141 12 174 57 75 127 58 36 15 21 125 164 2 84 84 5 110 52 136 37 145 153 90 99 0 181 121 10 120 72 61 13 36 35 70 111 114 128 99 81 102 176 46 104 60 130 61 122 135 150 159 32 103 50 83 55 183 4 65 103 28 79 69 65 114 139 128 181 20 28 62 122 4 108 178 17 191 191 139 78 141 99 110 197 149 193 52 132 150 70 187 178 149 56 43 63 148 172 44 168 152 59 42 108 167 172 125 110 163 65 188 105 164 50 54 65 44 106 149 146 176 88 124 125 145 120 141 45 44 137 165 196 196 159 56 116 131 182 178 94 47 167 151 163 169 5 180 165 112 129 111 40 17 36 166 114 108 59 111 152 196 76 100 145 35 156 61 166 90 39 13 89 158 164 4 128 170 184 45 34 65 157 74 35 145 192 149 53 51 13 157 0 41 9 145 29 117 6 195 8 197 160 97 108 125 102 188
Could you please explain this? If this is python/shell issue and how can I overcome it ? I am trying to run a hackerrank test case which is having very large input around 200000. But I am not able to run that testcase in my terminal due to this limitation.
This is indeed a limitation specific to the shell, rather than Python. Just to bring your attention to some things, here is what you can do in the future:
Initial hint - if you paste this and attempt to add characters in a modern shell you see you can't!
paste your input into a file, preferably with one item on a line.
Add a few debug lines
if __name__ == '__main__':
iplist = list(map(int, input().rstrip().split()))
with open('test.dat','w') as fd:
fd.write('\n'.join(str(x) for x in iplist))
print("len of exp: ",len(iplist),iplist[0],iplist[-1])
So now you have a quick reference to the first and last read items in the list, and a file containing the entire read list. Immediately you see the last item is 188 - suspicious.
If you pasted your input into a file in (1) you can easily check line 1187 is indeed 188.
Using the test file above you can count characters in the input actually read using a tool such as wc -c test.dat.
I get 4095, which is suspiciously close to 4096 = 4 KiB (often written as kB)
This is a clear hint for a "system" level limitation, likely your shell, limiting the amount of characters you are allowed to put in a single line. This specific limitation is pretty standard, and you can probably find somewhere the documentation for the limit.
Jack's answer is the way to go here - this is no way to read large input.
You are correct that there is a character limit in shell commands which it looks like you are hitting with that much of data on the command line.
I would refer you to the man page for that but you will not need to know it precisely hopefully ever.
The reason for that is you'll never want to put yourself in this position and to avoid that, all you need to do is save your input to a file, and change your python to open that file and read it line by line. Many examples on SO how to do something like that.
I hope that helps.

process.memoryUsage returns unvalide values

I have an express API and I want to show the api memory usage, to test the solution, I create a global variable in the module and for each get request I PUSH a data to the array to see if memory increase or no
let array = [];
const randomData = `150 216 86 129 25 116 72 20 155 148 91 30 187 152 136 204 125 182 250
217 97 45 161 48 223 1 55 163 236 240 179 118 234 175 71 56 44 221 245 59 145 66 173 1
12 197 88 146 140 111 223 59 169 53 68 123 0 252 68 96 215 132 236 245 128 43 98 16 110
22 5 179 12 177 87 162 5 134 64 226 250 70 238 114 215 135 147 85 218 140 194 244 107 62
87 19 169 227 2 97 184 215 164 30 34 229 35 46 71 127 120 75 243 68 143 40 203 132 211 212
253 136 159 24 149 241 58 167 199 247 140 229 151 85 65 25 44 106 199 216 110 61 72 135
103 251 122 103 128 134 9 25 38 61 136 159 158 225 137 44 246 176 217 202 149 73 111 73 22
41 151 217 59 69 10 143 85 181 10 194 64 23 244 243 179 240 150 25 111 162 60 221 197 36 191
138 217 185 1 127 226 152 75 7 250 72 147 242 184 70 158 211 154 225 165 130 57 24 50 97 192
125 88 131 183 171 67 209 251 151 64 11 59 206 75 143 17 34 203 95 97 57 209 212 112 99 180
136 142 230 163 82 172 232 134 135 50 101 144 75 94 145 236 206 182 124 120 95 225 144 31 79
75 27 214 115 37 25 122 6 106 26 66 145 135 73 22 53 13 57 202 129 61 42 207 138 143 170 241
`;
exports.getAPIHealth = function (req, res) {
console.log(process.memoryUsage())
const memoryUsedMB = process.memoryUsage().heapUsed / (1024 * 1024);
console.log(memoryUsedMB);
array.push(randomData.toString());
res.status(200).json({
live: true,
memoryUsage: memoryUsedMB.toFixed(2) + ' MB'
})
};
In fact when I run this example I got strange values:
{ rss: 57921536,
heapTotal: 57929728,
heapUsed: 18556128,
external: 655899 }
17.73406219482422
{ rss: 58200064,
heapTotal: 57929728,
heapUsed: 18717496,
external: 655899 }
17.854393005371094
{ rss: 58200064,
heapTotal: 57929728,
heapUsed: 18760720,
external: 655899 }
17.894927978515625
{ rss: 58200064,
heapTotal: 57929728,
heapUsed: 18797824,
external: 655899 }
17.930313110351562
{ rss: 58220544,
heapTotal: 57929728,
heapUsed: 18834928,
external: 655899 }
17.965728759765625
{ rss: 41418752,
heapTotal: 25423872,
heapUsed: 18512640,
external: 153782 }
17.659194946289062
memory increase for each request (and this is normal) but at certain point it decrease,
can any one tell me why I have this behavior ?
NB: I notice that memory usage never reach 18MB (even after many requests)

SAS Character Comparisons

I'm very new at SAS and I have a problem. I have a dataset like this:
Dataset_idchemo
and I want to create a new dummy variable with 0 if Chemo = NonTreated else 1, but idk why I can't, the result is a column with only zeros and a bunch of warnings like " Invalid numeric data, 'Treated' , at line 74 column 13."
My code is:
data new;
set readm;
chemio = 0;
if chemo =: 'Treated' then chemio = 1;
run;
Thanks!
PS: this is my dataset, I don't know if this is the right way to add it here, let me know what's the best way.
There are four columns Oss it's the number of the observation, id, event (0 or 1) and chemo ("Treated", "NonTreated")
Oss id event chemo
1 1 1 Treated
2 1 1 Treated
3 1 0 Treated
4 2 1 NonTreated
5 2 0 NonTreated
6 3 1 NonTreated
7 3 0 NonTreated
8 4 1 Treated
9 4 1 Treated
10 4 1 Treated
11 4 1 Treated
12 4 0 Treated
13 5 1 NonTreated
14 5 0 NonTreated
15 6 1 Treated
16 6 1 Treated
17 6 1 Treated
18 6 0 Treated
19 7 1 Treated
20 7 1 Treated
21 7 1 Treated
22 7 0 Treated
23 8 0 NonTreated
24 9 1 NonTreated
25 9 0 NonTreated
26 10 0 Treated
27 11 1 Treated
28 11 1 Treated
29 11 0 Treated
30 12 0 Treated
31 13 1 NonTreated
32 13 0 NonTreated
33 14 0 Treated
34 15 1 NonTreated
35 15 1 NonTreated
36 15 0 NonTreated
37 16 1 NonTreated
38 16 0 NonTreated
39 17 0 NonTreated
40 18 0 Treated
41 19 0 Treated
42 20 1 Treated
43 20 0 Treated
44 21 1 Treated
45 21 0 Treated
46 22 0 Treated
47 23 1 Treated
48 23 0 Treated
49 24 1 Treated
50 24 0 Treated
51 25 0 Treated
52 26 0 Treated
53 27 0 Treated
54 28 0 NonTreated
55 29 1 Treated
56 29 0 Treated
57 30 0 Treated
58 31 1 Treated
59 31 0 Treated
60 32 1 NonTreated
61 32 1 NonTreated
62 32 0 NonTreated
63 33 1 Treated
64 33 1 Treated
65 33 1 Treated
66 33 0 Treated
67 34 0 Treated
68 35 1 Treated
69 35 0 Treated
70 36 0 Treated
71 37 1 NonTreated
72 37 1 NonTreated
73 37 0 NonTreated
74 38 0 NonTreated
75 39 0 Treated
76 40 1 Treated
77 40 1 Treated
78 40 1 Treated
79 40 1 Treated
80 40 1 Treated
81 40 1 Treated
82 40 0 Treated
83 41 1 Treated
84 41 0 Treated
85 42 1 Treated
86 42 1 Treated
87 42 0 Treated
88 43 1 Treated
89 43 1 Treated
90 43 0 Treated
91 44 1 NonTreated
92 44 0 NonTreated
93 45 0 NonTreated
94 46 0 Treated
95 47 0 NonTreated
96 48 0 NonTreated
97 49 1 NonTreated
98 49 0 NonTreated
99 50 1 NonTreated
100 50 0 NonTreated
101 51 1 NonTreated
102 51 1 NonTreated
103 51 0 NonTreated
104 52 1 NonTreated
105 52 1 NonTreated
106 52 1 NonTreated
107 52 1 NonTreated
108 52 0 NonTreated
109 53 1 Treated
110 53 1 Treated
111 53 0 Treated
112 54 1 NonTreated
113 54 0 NonTreated
114 55 0 Treated
115 56 0 Treated
116 57 0 NonTreated
117 58 0 Treated
118 59 0 Treated
119 60 1 NonTreated
120 60 0 NonTreated
121 61 0 Treated
122 62 0 Treated
123 63 0 Treated
124 64 1 Treated
125 64 0 Treated
126 65 1 Treated
127 65 0 Treated
128 66 0 Treated
129 67 0 NonTreated
130 68 1 NonTreated
131 68 0 NonTreated
132 69 0 Treated
133 70 0 Treated
134 71 1 Treated
135 71 1 Treated
136 71 0 Treated
137 72 0 Treated
138 73 0 Treated
139 74 0 NonTreated
140 75 0 Treated
141 76 1 NonTreated
142 76 1 NonTreated
143 76 0 NonTreated
144 77 0 NonTreated
145 78 1 NonTreated
146 78 1 NonTreated
147 78 1 NonTreated
148 78 1 NonTreated
149 78 0 NonTreated
150 79 1 Treated
151 79 0 Treated
152 80 0 NonTreated
153 81 0 NonTreated
154 82 1 NonTreated
155 82 0 NonTreated
156 83 1 Treated
157 83 0 Treated
158 84 1 NonTreated
159 84 0 NonTreated
160 85 0 Treated
161 86 1 Treated
162 86 1 Treated
163 86 0 Treated
164 87 1 Treated
165 87 0 Treated
166 88 1 NonTreated
167 88 0 NonTreated
168 89 0 Treated
169 90 0 Treated
170 91 1 NonTreated
171 91 1 NonTreated
172 91 0 NonTreated
173 92 0 NonTreated
174 93 1 NonTreated
175 93 1 NonTreated
176 93 1 NonTreated
177 93 0 NonTreated
178 94 1 Treated
179 94 0 Treated
180 95 0 Treated
181 96 0 Treated
182 97 1 Treated
183 97 1 Treated
184 97 1 Treated
185 97 0 Treated
186 98 1 Treated
187 98 1 Treated
188 98 0 Treated
189 99 0 NonTreated
190 100 1 NonTreated
191 100 0 NonTreated
192 101 0 Treated
193 102 1 Treated
194 102 1 Treated
195 102 0 Treated
196 103 1 NonTreated
197 103 0 NonTreated
198 104 0 NonTreated
199 105 0 NonTreated
200 106 0 Treated
201 107 0 Treated
202 108 1 Treated
203 108 0 Treated
204 109 1 NonTreated
205 109 0 NonTreated
206 110 0 Treated
207 111 0 Treated
208 112 0 Treated
209 113 0 NonTreated
210 114 1 NonTreated
211 114 1 NonTreated
212 114 1 NonTreated
213 114 1 NonTreated
214 114 1 NonTreated
215 114 1 NonTreated
216 114 1 NonTreated
217 114 1 NonTreated
218 114 1 NonTreated
219 114 0 NonTreated
220 115 1 NonTreated
221 115 1 NonTreated
222 115 0 NonTreated
223 116 0 NonTreated
224 117 1 NonTreated
225 117 0 NonTreated
226 118 1 Treated
227 118 0 Treated
228 119 1 NonTreated
229 119 0 NonTreated
230 120 0 NonTreated
231 121 0 NonTreated
232 122 1 NonTreated
233 122 1 NonTreated
234 122 1 NonTreated
235 122 1 NonTreated
236 122 0 NonTreated
237 123 0 Treated
238 124 0 NonTreated
239 125 1 Treated
240 125 0 Treated
241 126 1 Treated
242 126 0 Treated
243 127 0 NonTreated
244 128 1 NonTreated
245 128 0 NonTreated
246 129 1 NonTreated
247 129 1 NonTreated
248 129 0 NonTreated
249 130 0 Treated
250 131 1 NonTreated
251 131 1 NonTreated
252 131 1 NonTreated
253 131 1 NonTreated
254 131 0 NonTreated
255 132 1 NonTreated
256 132 0 NonTreated
257 133 1 NonTreated
258 133 1 NonTreated
259 133 1 NonTreated
260 133 0 NonTreated
261 134 1 NonTreated
262 134 0 NonTreated
263 135 1 NonTreated
264 135 1 NonTreated
265 135 1 NonTreated
266 135 1 NonTreated
267 135 0 NonTreated
268 136 1 NonTreated
269 136 1 NonTreated
270 136 1 NonTreated
271 136 1 NonTreated
272 136 0 NonTreated
273 137 0 NonTreated
274 138 1 Treated
275 138 1 Treated
276 138 1 Treated
277 138 0 Treated
278 139 0 NonTreated
279 140 0 Treated
280 141 1 Treated
281 141 1 Treated
282 141 1 Treated
283 141 0 Treated
284 142 1 Treated
285 142 0 Treated
286 143 1 NonTreated
287 143 0 NonTreated
288 144 1 Treated
289 144 0 Treated
290 145 0 Treated
291 146 1 NonTreated
292 146 0 NonTreated
293 147 1 Treated
294 147 1 Treated
295 147 1 Treated
296 147 1 Treated
297 147 0 Treated
298 148 1 Treated
299 148 0 Treated
300 149 1 Treated
301 149 1 Treated
302 149 0 Treated
303 150 1 Treated
304 150 0 Treated
305 151 0 Treated
306 152 0 Treated
307 153 1 NonTreated
308 153 1 NonTreated
309 153 0 NonTreated
310 154 1 Treated
311 154 1 Treated
312 154 0 Treated
313 155 0 Treated
314 156 1 Treated
315 156 1 Treated
316 156 0 Treated
317 157 0 Treated
318 158 0 Treated
319 159 0 Treated
320 160 1 Treated
321 160 1 Treated
322 160 0 Treated
323 161 0 NonTreated
324 162 0 Treated
325 163 0 NonTreated
326 164 0 Treated
327 165 0 Treated
328 166 0 NonTreated
329 167 0 Treated
330 168 1 NonTreated
331 168 0 NonTreated
332 169 0 NonTreated
333 170 1 NonTreated
334 170 1 NonTreated
335 170 0 NonTreated
336 171 1 NonTreated
337 171 1 NonTreated
338 171 0 NonTreated
339 172 0 Treated
340 173 0 Treated
341 174 1 Treated
342 174 1 Treated
343 174 1 Treated
344 174 1 Treated
345 174 0 Treated
346 175 0 Treated
347 176 1 Treated
348 176 0 Treated
349 177 1 NonTreated
350 177 1 NonTreated
351 177 0 NonTreated
352 178 0 NonTreated
353 179 0 Treated
354 180 1 Treated
355 180 0 Treated
356 181 0 Treated
357 182 0 NonTreated
358 183 1 Treated
359 183 1 Treated
360 183 1 Treated
361 183 1 Treated
362 183 1 Treated
363 183 0 Treated
364 184 1 NonTreated
365 184 0 NonTreated
366 185 1 NonTreated
367 185 0 NonTreated
368 186 1 NonTreated
369 186 1 NonTreated
370 186 1 NonTreated
371 186 0 NonTreated
372 187 1 NonTreated
373 187 1 NonTreated
374 187 0 NonTreated
375 188 0 Treated
376 189 0 Treated
377 190 1 Treated
378 190 1 Treated
379 190 0 Treated
380 191 1 Treated
381 191 1 Treated
382 191 0 Treated
383 192 1 NonTreated
384 192 1 NonTreated
385 192 1 NonTreated
386 192 0 NonTreated
387 193 0 NonTreated
388 194 1 Treated
389 194 0 Treated
390 195 0 Treated
391 196 0 Treated
392 197 0 NonTreated
393 198 1 Treated
394 198 0 Treated
395 199 1 NonTreated
396 199 0 NonTreated
397 200 0 Treated
398 201 1 Treated
399 201 1 Treated
400 201 1 Treated
401 201 1 Treated
402 201 1 Treated
403 201 1 Treated
404 201 0 Treated
405 202 1 NonTreated
406 202 1 NonTreated
407 202 0 NonTreated
408 203 1 Treated
409 203 0 Treated
410 204 0 NonTreated
411 205 0 Treated
412 206 1 Treated
413 206 0 Treated
414 207 0 Treated
415 208 1 Treated
416 208 0 Treated
417 209 1 Treated
418 209 1 Treated
419 209 1 Treated
420 209 1 Treated
421 209 1 Treated
422 209 1 Treated
423 209 0 Treated
424 210 0 Treated
425 211 0 NonTreated
426 212 1 NonTreated
427 212 1 NonTreated
428 212 1 NonTreated
429 212 0 NonTreated
430 213 0 Treated
431 214 1 Treated
432 214 1 Treated
433 214 1 Treated
434 214 1 Treated
435 214 0 Treated
436 215 0 Treated
437 216 0 Treated
438 217 0 Treated
439 218 0 Treated
440 219 1 NonTreated
441 219 1 NonTreated
442 219 1 NonTreated
443 219 0 NonTreated
444 220 1 Treated
445 220 1 Treated
446 220 0 Treated
447 221 1 Treated
448 221 1 Treated
449 221 0 Treated
450 222 0 Treated
451 223 0 Treated
452 224 1 NonTreated
453 224 0 NonTreated
454 225 0 Treated
455 226 1 NonTreated
456 226 0 NonTreated
457 227 0 NonTreated
458 228 1 Treated
459 228 1 Treated
460 228 1 Treated
461 228 1 Treated
462 228 1 Treated
463 228 0 Treated
464 229 1 Treated
465 229 0 Treated
466 230 0 Treated
467 231 0 Treated
468 232 1 NonTreated
469 232 1 NonTreated
470 232 1 NonTreated
471 232 1 NonTreated
472 232 0 NonTreated
473 233 0 NonTreated
474 234 0 Treated
475 235 1 NonTreated
476 235 1 NonTreated
477 235 0 NonTreated
478 236 0 Treated
479 237 1 NonTreated
480 237 0 NonTreated
481 238 0 Treated
482 239 0 Treated
483 240 1 NonTreated
484 240 1 NonTreated
485 240 0 NonTreated
486 241 1 NonTreated
487 241 0 NonTreated
488 242 1 NonTreated
489 242 1 NonTreated
490 242 0 NonTreated
491 243 1 NonTreated
492 243 1 NonTreated
493 243 1 NonTreated
494 243 0 NonTreated
495 244 0 Treated
496 245 0 Treated
497 246 1 Treated
498 246 0 Treated
499 247 1 Treated
500 247 1 Treated
501 247 0 Treated
502 248 0 NonTreated
503 249 0 NonTreated
504 250 1 NonTreated
505 250 0 NonTreated
506 251 1 NonTreated
507 251 0 NonTreated
508 252 1 Treated
509 252 0 Treated
510 253 1 NonTreated
511 253 0 NonTreated
512 254 1 NonTreated
513 254 1 NonTreated
514 254 0 NonTreated
515 255 0 Treated
516 256 1 Treated
517 256 0 Treated
518 257 0 Treated
519 258 0 Treated
520 259 0 NonTreated
521 260 0 Treated
522 261 0 Treated
523 262 1 Treated
524 262 0 Treated
525 263 1 NonTreated
526 263 0 NonTreated
527 264 0 NonTreated
528 265 0 NonTreated
529 266 0 NonTreated
530 267 0 NonTreated
531 268 0 NonTreated
532 269 1 NonTreated
533 269 1 NonTreated
534 269 1 NonTreated
535 269 1 NonTreated
536 269 1 NonTreated
537 269 1 NonTreated
538 269 1 NonTreated
539 269 1 NonTreated
540 269 1 NonTreated
541 269 1 NonTreated
542 269 0 NonTreated
543 270 1 Treated
544 270 1 Treated
545 270 0 Treated
546 271 0 Treated
547 272 1 Treated
548 272 0 Treated
549 273 0 Treated
550 274 1 NonTreated
551 274 1 NonTreated
552 274 1 NonTreated
553 274 1 NonTreated
554 274 1 NonTreated
555 274 1 NonTreated
556 274 1 NonTreated
557 274 1 NonTreated
558 274 1 NonTreated
559 274 1 NonTreated
560 274 1 NonTreated
561 274 1 NonTreated
562 274 1 NonTreated
563 274 1 NonTreated
564 274 1 NonTreated
565 274 1 NonTreated
566 274 0 NonTreated
567 275 1 Treated
568 275 0 Treated
569 276 1 NonTreated
570 276 1 NonTreated
571 276 1 NonTreated
572 276 0 NonTreated
573 277 1 NonTreated
574 277 0 NonTreated
575 278 1 Treated
576 278 1 Treated
577 278 0 Treated
578 279 0 NonTreated
579 280 1 NonTreated
580 280 1 NonTreated
581 280 1 NonTreated
582 280 1 NonTreated
583 280 0 NonTreated
584 281 0 NonTreated
585 282 1 NonTreated
586 282 1 NonTreated
587 282 0 NonTreated
588 283 1 NonTreated
589 283 0 NonTreated
590 284 0 NonTreated
591 285 0 NonTreated
592 286 0 NonTreated
593 287 0 Treated
594 288 1 Treated
595 288 0 Treated
596 289 0 Treated
597 290 1 NonTreated
598 290 0 NonTreated
599 291 0 Treated
600 292 1 NonTreated
601 292 0 NonTreated
602 293 0 NonTreated
603 294 0 Treated
604 295 0 Treated
605 296 1 Treated
606 296 0 Treated
607 297 0 NonTreated
608 298 1 NonTreated
609 298 1 NonTreated
610 298 1 NonTreated
611 298 1 NonTreated
612 298 1 NonTreated
613 298 0 NonTreated
614 299 0 NonTreated
615 300 1 Treated
616 300 0 Treated
617 301 1 NonTreated
618 301 1 NonTreated
619 301 1 NonTreated
620 301 0 NonTreated
621 302 1 Treated
622 302 1 Treated
623 302 0 Treated
624 303 0 Treated
625 304 1 NonTreated
626 304 1 NonTreated
627 304 1 NonTreated
628 304 1 NonTreated
629 304 0 NonTreated
630 305 1 NonTreated
631 305 0 NonTreated
632 306 0 Treated
633 307 1 Treated
634 307 0 Treated
635 308 0 NonTreated
636 309 1 NonTreated
637 309 1 NonTreated
638 309 1 NonTreated
639 309 0 NonTreated
640 310 1 NonTreated
641 310 0 NonTreated
642 311 0 Treated
643 312 0 NonTreated
644 313 0 NonTreated
645 314 0 Treated
646 315 1 Treated
647 315 0 Treated
648 316 1 Treated
649 316 0 Treated
650 317 1 NonTreated
651 317 1 NonTreated
652 317 1 NonTreated
653 317 1 NonTreated
654 317 1 NonTreated
655 317 1 NonTreated
656 317 1 NonTreated
657 317 1 NonTreated
658 317 0 NonTreated
659 318 1 Treated
660 318 1 Treated
661 318 1 Treated
662 318 1 Treated
663 318 1 Treated
664 318 1 Treated
665 318 0 Treated
666 319 0 Treated
667 320 1 NonTreated
668 320 0 NonTreated
669 321 1 Treated
670 321 1 Treated
671 321 0 Treated
672 322 1 Treated
673 322 0 Treated
674 323 0 NonTreated
675 324 1 Treated
676 324 0 Treated
677 325 1 NonTreated
678 325 1 NonTreated
679 325 1 NonTreated
680 325 0 NonTreated
681 326 0 Treated
682 327 1 NonTreated
683 327 1 NonTreated
684 327 1 NonTreated
685 327 1 NonTreated
686 327 0 NonTreated
687 328 0 NonTreated
688 329 0 Treated
689 330 0 NonTreated
690 331 1 Treated
691 331 0 Treated
692 332 0 Treated
693 333 0 Treated
694 334 1 NonTreated
695 334 0 NonTreated
696 335 1 NonTreated
697 335 0 NonTreated
698 336 1 NonTreated
699 336 1 NonTreated
700 336 1 NonTreated
701 336 1 NonTreated
702 336 1 NonTreated
703 336 0 NonTreated
704 337 0 NonTreated
705 338 0 Treated
706 339 1 NonTreated
707 339 1 NonTreated
708 339 0 NonTreated
709 340 0 NonTreated
710 341 0 Treated
711 342 0 NonTreated
712 343 0 NonTreated
713 344 0 Treated
714 345 0 Treated
715 346 0 Treated
716 347 1 NonTreated
717 347 1 NonTreated
718 347 1 NonTreated
719 347 0 NonTreated
720 348 1 NonTreated
721 348 1 NonTreated
722 348 1 NonTreated
723 348 1 NonTreated
724 348 0 NonTreated
725 349 1 NonTreated
726 349 0 NonTreated
727 350 1 NonTreated
728 350 1 NonTreated
729 350 1 NonTreated
730 350 1 NonTreated
731 350 1 NonTreated
732 350 1 NonTreated
733 350 1 NonTreated
734 350 1 NonTreated
735 350 1 NonTreated
736 350 1 NonTreated
737 350 1 NonTreated
738 350 1 NonTreated
739 350 1 NonTreated
740 350 1 NonTreated
741 350 1 NonTreated
742 350 1 NonTreated
743 350 1 NonTreated
744 350 1 NonTreated
745 350 1 NonTreated
746 350 1 NonTreated
747 350 1 NonTreated
748 350 1 NonTreated
749 350 0 NonTreated
750 351 1 NonTreated
751 351 1 NonTreated
752 351 1 NonTreated
753 351 0 NonTreated
754 352 0 NonTreated
755 353 1 NonTreated
756 353 0 NonTreated
757 354 1 NonTreated
758 354 0 NonTreated
759 355 1 Treated
760 355 0 Treated
761 356 0 NonTreated
762 357 1 NonTreated
763 357 0 NonTreated
764 358 0 NonTreated
765 359 0 Treated
766 360 0 Treated
767 361 1 NonTreated
768 361 0 NonTreated
769 362 0 Treated
770 363 0 Treated
771 364 0 Treated
772 365 0 NonTreated
773 366 1 Treated
774 366 0 Treated
775 367 0 Treated
776 368 1 NonTreated
777 368 1 NonTreated
778 368 0 NonTreated
779 369 1 NonTreated
780 369 0 NonTreated
781 370 1 NonTreated
782 370 1 NonTreated
783 370 0 NonTreated
784 371 0 Treated
785 372 0 NonTreated
786 373 0 Treated
787 374 0 Treated
788 375 0 Treated
789 376 0 NonTreated
790 377 0 Treated
791 378 1 NonTreated
792 378 1 NonTreated
793 378 0 NonTreated
794 379 1 Treated
795 379 1 Treated
796 379 1 Treated
797 379 1 Treated
798 379 1 Treated
799 379 0 Treated
800 380 0 NonTreated
801 381 0 Treated
802 382 0 NonTreated
803 383 1 Treated
804 383 0 Treated
805 384 0 Treated
806 385 0 Treated
807 386 0 Treated
808 387 0 NonTreated
809 388 0 NonTreated
810 389 1 Treated
811 389 1 Treated
812 389 1 Treated
813 389 0 Treated
814 390 0 NonTreated
815 391 0 Treated
816 392 1 NonTreated
817 392 0 NonTreated
818 393 1 NonTreated
819 393 1 NonTreated
820 393 1 NonTreated
821 393 1 NonTreated
822 393 1 NonTreated
823 393 0 NonTreated
824 394 1 Treated
825 394 0 Treated
826 395 1 Treated
827 395 0 Treated
828 396 1 Treated
829 396 1 Treated
830 396 1 Treated
831 396 1 Treated
832 396 1 Treated
833 396 0 Treated
834 397 1 NonTreated
835 397 1 NonTreated
836 397 1 NonTreated
837 397 0 NonTreated
838 398 1 Treated
839 398 0 Treated
840 399 1 NonTreated
841 399 1 NonTreated
842 399 1 NonTreated
843 399 1 NonTreated
844 399 1 NonTreated
845 399 1 NonTreated
846 399 1 NonTreated
847 399 1 NonTreated
848 399 1 NonTreated
849 399 1 NonTreated
850 399 1 NonTreated
851 399 0 NonTreated
852 400 0 Treated
853 401 1 NonTreated
854 401 1 NonTreated
855 401 1 NonTreated
856 401 1 NonTreated
857 401 1 NonTreated
858 401 0 NonTreated
859 402 1 NonTreated
860 402 0 NonTreated
861 403 0 Treated
Your problem is not in the code you posten, but right before it. You did not succesfully create readm. To show that, run the following code:
proc print data=readm (obs=9);
run;
(The obs= is just there to limit the listing to 9 observations.)
Somehow, SAS must be informed your fourth column is a text column
You probably wrote someting like
data readm;
infile 'C:\<some path>\<some file>';
input Oss id event chemo;
run;
I would read this as
data readm;
infile 'C:\<some path>\<some file>' truncover dsd dlm='09'x;
input Oss id event chemo $9.;
run;
In this
dcd specifies you have a delimiters
dlm='09'x specifies your delimiters are tabs
`$9.' specifies the chemo field is a character field of up to 9 characters.
truncover specifies you do not want to read the next line to find the last characters of the 'chemo' field on the next line
If this is not realy the answer to your question, tell us how you did creat/import readm and we will see what we can do.
Disclaimer: This code is not tested. If it bugs, please inform me, and I will debug it.

What is a valid "letter" for named ranges in Excel?

According to the Excel documentation: Learn about syntax rules for names:
Valid characters The first character of a name must be a letter, an
underscore character (_), or a backslash (). Remaining characters in
the name can be letters, numbers, periods, and underscore characters.
But what exactly is a letter?
I thought this means only ASCII letters, like: A-Z and a-z
But obviously I am wrong, because also the following work (on my English Excel 2013):
German umlauts: Ö,ö,Ü,ü, etc.
French accents: é, ê, etc.
So how can I check in VBA which characters in a string are valid and which are not?
I ran this tiny bit of code:
Sub WhatsInAName()
Dim i As Long, CH As String, r As Range, msg As String
Dim K As Long
Set r = Range("A1")
On Error Resume Next
K = 1
For i = 1 To 255
CH = Chr(i)
r.Name = CH
If Err.Number = 0 Then
Cells(K, 1) = i
K = K + 1
Else
Err.Number = 0
End If
Next i
On Error GoTo 0
End Sub
which should record the ascii codes for valid name starters. I got this:
65
66
68
69
70
71
72
73
74
75
76
77
78
79
80
81
83
84
85
86
87
88
89
90
92
95
97
98
100
101
102
103
104
105
106
107
108
109
110
111
112
113
115
116
117
118
119
120
121
122
131
133
134
135
137
138
140
142
145
146
147
148
150
151
153
154
156
158
159
161
164
167
168
170
173
175
176
177
178
179
180
181
182
183
184
185
186
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
I have no idea why 67 is missing.
EDIT#5:
Here is a list of the valid characters after the first character:
32
46
48
49
50
51
52
53
54
55
56
57
63
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
92
95
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
128
131
133
134
135
136
137
138
140
142
145
146
147
148
150
151
152
153
154
156
158
159
161
164
167
168
170
173
175
176
177
178
179
180
181
182
183
184
185
186
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
Thanks to Martin Trummer.
It turns out that the answer to the question is quite complex. The answer from user
Gary's Student is already quite close, but here are more things to consider:
single-character names:
Examples:
"a" is allowed
"c" is not allowed
characters at the start:
Examples:
"cX" is allowed
"?X" is not allowed
characters after the start
Examples:
"_?" is allowed ("?", "?_" are not)
combinations:
"R1048576C1" invalid
"R1048577C1" valid
"\xx" valid
"\x" invalid
unicode
Workbook names vs. Worksheet names:
e.g. "\a" is allowed on the Worksheet, but not on the Workbook
I've made a GitHub project excel-names which includes an Excel Sheet with a list of valid characters (also unicode) and some VBA code that you can use.
Moreover, the project includes functions that consider the full Excel Name (not only single characters): read the documentation for full details
I know this is old and I might be a litle off topic but I have just ran into a problem whit Excel named ranges.
I was trying to use names like CP01 , CP02, ... and, well, excel keeps telling that those were invalid names although no invalid characters were in the name.
Adding an underscore solves the problem. Names like CP01_ or CP_01 works just fine.
So there is resctriction with valid characters and, as has already been refered, there are also restrictions with the combination of the characters.
I haven't been throug the bottom of the question but, besides the previousily refered combinations of characters, it's not also possible to use any combination of characters that can be interperted as cell adress in A1 notation.

Resources