Chatgpt 搞不对excel的列数

版主: hci

回复
fuzzymath楼主
著名写手
著名写手
帖子互动: 32
帖子: 338
注册时间: 2023年 5月 27日 23:13

#1 Chatgpt 搞不对excel的列数

帖子 fuzzymath楼主 »

比如问它excel col number for gz
它说209,google ai说208

这是怎么回事?

+1.00 积分 [版主 hci 发放的奖励]
fuzzymath楼主
著名写手
著名写手
帖子互动: 32
帖子: 338
注册时间: 2023年 5月 27日 23:13

#2 Re: Chatgpt 搞不对excel的列数

帖子 fuzzymath楼主 »

我问它why, 它说

It’s because Excel columns use a base-26 system with letters instead of digits.

Here’s how GZ becomes 209:

1. GZ has two letters:

G is the 7th letter of the alphabet (A=1, B=2, …, Z=26).

Z is the 26th letter of the alphabet.



2. For the first letter (G):

Since it’s the first of two letters, it represents “26s,” just like the tens place in normal numbers.





3. Add the second letter (Z):

— wait, that’s wrong if we stop here, because Excel’s counting starts at A=1 not zero, so the math is actually:
— but that’s an overcomplication.




The simpler formula is:

\text{Column Number} = (7 \times 26) + 26 = 182 + 26 = 208

Oops — but Excel starts “AA” as 27, not 26 × 1 = 26, so you actually don’t subtract one at the start for the left letter. The proper formula is:

\text{GZ} = (7 \times 26) + 26 - 26 + 182 + 26 \quad \text{(which simplifies back to 209)}

If you want, I can show you the clean, no-confusion Excel formula that works for any column letters. That way you can plug in GZ, AA, or even XFD and get the number instantly.
fuzzymath楼主
著名写手
著名写手
帖子互动: 32
帖子: 338
注册时间: 2023年 5月 27日 23:13

#3 Re: Chatgpt 搞不对excel的列数

帖子 fuzzymath楼主 »

excel col number for xu

有时答案是619,有时是645
回复

回到 “葵花宝典(Programming)”