入黎免費幫你砌excel表 / 教你formula (4)

伊原摩耶花

999 回覆
47 Like 6 Dislike
唧唧復唧唧 2020-09-07 21:39:36
想問下以下情況if function應該點樣用?
首先我用左if cell X1 value>3,true=’>‘,false=’<‘ 出個好睇d既presentation

之後我要根據佢既cell X1 answer係大過or細過3而要用唔同既formula做第二個step,例如如果x>3,cell Z1=cell A1+cell B1,<3就Z1=A1*B1

呢個時候第二個if 應該點樣寫?研究左一個鐘
浮浪者 2020-09-07 21:49:13
用power query 或者power pivot做join table
@siuyeong 2020-09-07 21:50:16


=IF(A1>3,B1,IF(A1<3,C1,"兩者不是"))

影片演示
https://streamable.com/99m99j
小小小老母 2020-09-07 21:59:06
我諗個做法應該係如果cell is not blank, 就拎返header既value, 可以用concat 曬成個row既text,然後前面再 A2&”:”&concat左既野
小小小老母 2020-09-07 22:02:55
我反而睇極都唔明佢想做啲咩
小小小老母 2020-09-07 22:04:49
用google scripts 可以成個cell.value().split()
再loop一次個list, if number 就.push()
小小小老母 2020-09-07 22:06:51
實際上我覺得python仲易過excel
sdvsvsdav 2020-09-07 22:07:25
Option Explicit

Sub test()
Dim regExp As Object
Dim str As String
Dim replaced_str As String
Dim replaced_str_array As Variant
Dim i As Long, j As Long
Dim result_array() As Long

Set regExp = CreateObject("vbscript.RegExp") 'late binding
str = "hfgh12hfbk34ggh4"
regExp.Pattern = "[^0-9]"
regExp.Global = True

If regExp.test(str) Then
    replaced_str = regExp.Replace(str, ",")
End If
replaced_str_array = Split(replaced_str, ",")

j = 0
For i = LBound(replaced_str_array) To UBound(replaced_str_array)
    If replaced_str_array(i) <> "" Then
        j = j + 1
    End If
Next i

ReDim result_array(0 To j - 1)
j = 0
For i = LBound(replaced_str_array) To UBound(replaced_str_array)
    If replaced_str_array(i) <> "" Then
        result_array(j) = CInt(replaced_str_array(i))
        j = j + 1
    End If
Next i
End Sub

小小小老母 2020-09-07 22:08:10
你要講清楚啲要做咩先
俾啲實際例子出來

睇你咁講我覺得要用到既係sumif(s) and()
小小小老母 2020-09-07 22:09:17
excel既if 就係vba 既if else
小小小老母 2020-09-07 22:11:37
佢應該係想 if(text(x1’)=“>”, a1+b1, a1*b1)
@siuyeong 2020-09-07 22:15:19
睇睇下 都覺得係
@siuyeong 2020-09-07 22:21:03
sdvsvsdav 2020-09-07 22:22:48
R is even easier, dun even need loop
na.omit(as.numeric(strsplit(gsub("[^0-9]", ",", "hfgh12hfbk34ggh4"), ",")[[1]]))
小小小老母 2020-09-07 22:35:57
我走入來導人去google的
方便到仆街 但係免費版係有限制
@siuyeong 2020-09-07 22:46:08
唧唧復唧唧 2020-09-07 23:19:15
sorry for 1999
many thanks!
伊原摩耶花 2020-09-08 01:18:37
其實冇話 excel 唔得
只係當 data 愈多
佢會愈 lag 咁解
不過好多時電腦冇裝其他 stat software
都係唯有用 excel 硬食

btw 都唔一定要寫 code
有 d software 都有 point-and-click 介面
你撳完佢背後自己 gen d code
如 sas entreprise
spss 都好似係
伊原摩耶花 2020-09-08 01:25:11
提提你
if 大過 3 既 FALSE 唔係細過 3
係細過或等如 3
伊原摩耶花 2020-09-08 09:17:16
有冇聽過 sas
sas enterprise guide (sas eg)
就係可以自己撳既 sas
都可以做到 query, join table, sort, summary, out table, out graph 等等
Paper_roll 2020-09-08 11:31:45
想整一個lucky draw function
要有button 禁

有7000 組數子
抽709件禮品

可以用tg問你嗎?
吹水台自選台熱 門最 新手機台時事台政事台World體育台娛樂台動漫台Apps台遊戲台影視台講故台健康台感情台家庭台潮流台美容台上班台財經台房屋台飲食台旅遊台學術台校園台汽車台音樂台創意台硬件台電器台攝影台玩具台寵物台軟件台活動台電訊台直播台站務台黑 洞