简体   繁体   中英

Show value if months equals current month

I have a google sheet with monthly targets per product, and in another sheet I want to reference this and only show the target of the current month.

            June 2022   July 2022   August 2022
Product 1   50          60          70
Product 2   20          40          60

The formula I tried is:

=IF(MONTH(A1)=MONTH(targets!$B$1:$D$1), targets!B2:D2, "")

Where A1 has =TODAY()

Use FILTER() function.

=FILTER(B2:D3,MONTH(B1:D1)=MONTH(F1))

在此处输入图像描述

You could also try

=index(B2:D3,0,match(G1,B1:D1))

But exact match might be safer

=index(B2:D3,0,match(eomonth(G1,-1)+1,B1:D1,0))

in case the required month is missing.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM