在Excel中将HEX转换为RGB [英] Convert HEX to RGB in Excel

查看:334
本文介绍了在Excel中将HEX转换为RGB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列"HEX"和三个列"R","G"和"B".

I have a column "HEX" and three columns "R", "G", and "B".

如何将十六进制转换为RGB,例如ff0000R=255G=0B=0?

How can I convert a HEX to RGB, e.g. ff0000 to R=255, G=0, and B=0?

我知道前2个字符ff属于"R",后2个00属于"G",最后2个00属于"B".因此,我将不得不在=RIGHT(LEFT(A1, 4), 2)=RIGHT(A1, 2)上使用=LEFT(A1, 2).

I know that the first 2 characters ff belongs to "R", the next 2 00 belongs to "G", and the final 2 00 belongs to "B". So I will have to use =LEFT(A1, 2) for "R", =RIGHT(LEFT(A1, 4), 2), and =RIGHT(A1, 2) for the last.

但是如何将ff转换为25500转换为0,等等?我想我需要做一些事情来从十六进制(以16为底)解析为十进制(以10为底)?

But how can I convert ff to 255 and 00 to 0, etc.? I guess I will have to do something to parse from hexadecimal (base 16) to decimal (base 10)?

我想在没有VBA的情况下这样做.

I would like to do it without VBA.

推荐答案

您可以使用HEX2DEC()函数将十六进制转换为十进制.例如:

You can convert from hex to decimal using the HEX2DEC() function. For instance:

=HEX2DEC(A1)

单元格A1中包含字符串FF的地方,将返回255.

Where cell A1 contains the string FF, this will return 255.

此处有更多详细信息.

这篇关于在Excel中将HEX转换为RGB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆