如何解决通过列匹配对两个表进行求和
我有两个表,第一个是货币和价值,第二个是货币和 x-rate。 通过匹配两个表中的货币列,我想将这些值相乘和求和。
货币 | 价值 |
---|---|
欧元 | 10 |
英镑 | 20 |
瑞士法郎 | 30 |
欧元 | 40 |
英镑 | 50 |
第二个
货币 | x_rate |
---|---|
欧元 | 1 |
英镑 | 1.2 |
瑞士法郎 | 1.3 |
结果应该是:import * as React from 'react';
import {
useState
} from 'react';
import {
Button,View,Text,Image,SafeAreaView,ScrollView,} from 'react-native';
import RadioButtonRN from 'radio-buttons-react-native';
import {
Card,Title
} from 'react-native-paper';
import Icon from 'react-native-vector-icons/FontAwesome';
import Constants from 'expo-constants';
function App() {
const [data,setData] = useState([{
label: 'data 1'
},{
label: 'data 2'
},]);
const [SecondData,setSecondData] = useState([{
label: 'data 5'
},{
label: 'data 6'
},{
label: 'data 7'
},{
label: 'data 8'
},]);
const keeper = data.map((item) => { <
Text > {
item.label
} < /Text>
console.log(item.label)
})
return ( <
SafeAreaView >
<
ScrollView showsverticalScrollIndicator >
<
View style = {
{
marginTop: Constants.statusBarHeight
}
} >
<
Card mode = "outlined"
style = {
{
borderColor: 'blue',padding: 10,backgroundColor: '#ccc',}
} >
<
Card.Content >
<
Title > SRC PRESIDENT < /Title> <
/Card.Content> <
RadioButtonRN data = {
keeper
}
selectedBtn = {
(e) => console.log(e)
}
icon = { < Icon name = "stop-circle"
size = {
25
}
color = "#2c9dd1" / >
}
/> <
/Card>
<
Card mode = "outlined"
style = {
{
borderColor: 'blue',marginTop: 20,}
} >
<
Card.Content >
<
Title > GENERAL SECRETARY < /Title> <
/Card.Content> <
RadioButtonRN data = {
SecondData
}
selectedBtn = {
(e) => console.log(e)
}
icon = { < Icon name = "check-circle"
size = {
25
}
color = "#2c9dd1" / >
}
/> <
/Card> <
/View> <
/ScrollView> <
/SafeAreaView>
);
}
export default App;
解决方法
使用数组公式:
=SUMPRODUCT(B2:B6*TRANSPOSE(E2:E4)*(A2:A6=TRANSPOSE(D2:D4)))
编辑后的数组公式按 ctrl
+ shift
+ enter
确认
=SUMPRODUCT(($B$2:$B$6)*INDEX($E$2:$E$4,MATCH($A$2:$A$6,$D$2:$D$4,0)))
其中 $A$2:$B$6 是第一桌,$D$2:$E$4 是第二桌。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。