Posts

Showing posts with the label multiple-columns

How to fill missing value based on column comparison Python

Image
Clash Royale CLAN TAG #URR8PPP How to fill missing value based on column comparison Python I want to fill the missing values in col 2 to corresponding col1. import pandas as pd data={"col1":["A","B","C","A","B","C","A","B","A"], "col2":["hey1"," ","hello2","hey2","he1","hello3"," ","","hey1"]} df=pd.DataFrame(data=data) It should fill it with some rules, given below: for example, if A is occuring four times and out of 4, it has corresponding col2 value for three times and fourth one is missing, so missing value should be a combination of all three. Like in this case 3 values are hey1, hey2, hey1. Fourth missing should contain hey2, hey1. Desired output: col1 col2 A hey1 B he1 C hello2 A hey2 B he1 C hello3 A hey1,hey2 B he1 A hey1 ...

Excel - SUMIFS for multiple columns

Image
Clash Royale CLAN TAG #URR8PPP Excel - SUMIFS for multiple columns I need to sum the values of several columns, if other cells in the same row match a predefined criteria. The working formula for only 3 columns is the following: =SUM(SUMIFS(‘Sheet1'!W:W; ‘Sheet1'!$B:$B;"Sales";‘Sheet1'!$C:$C;">=4");SUMIFS(‘Sheet1'!X:X; ‘Sheet1'!$B:$B;"Sales";‘Sheet1'!$C:$C;">=4");SUMIFS(‘Sheet1'!Y:Y; ‘Sheet1'!$B:$B;"Sales";‘Sheet1'!$C:$C;">=4")) I will need to use the formula for several cells (and sum more than 10 columns per time) and I will need to change the columns manually, so I need the same formula in the following way: =SUMIFS(‘Sheet1'!W:Y; ‘Sheet1'!$B:$B;"Sales";‘Sheet1'!$C:$C;">=4") ,but currently this formula leads to a "#VALUE!" error. The reason for that is (I assume) the use of multiple columns " W:Y " Can you suggest a workaround...